VirtualBox

Changeset 96850 in vbox


Ignore:
Timestamp:
Sep 26, 2022 4:39:32 AM (2 years ago)
Author:
vboxsync
Message:

Main/tstOVF: Use RTFileExists to test for the existance of a file, on the right file path, mind. Don't use TABs or leave trailing whitepace on lines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/tstOVF.cpp

    r96849 r96850  
    232232                    pcszType = "sound";
    233233                break;
    234                                
    235                                 case VirtualSystemDescriptionType_SettingsFile:
     234
     235                case VirtualSystemDescriptionType_SettingsFile:
    236236                    pcszType = "settings";
    237237                break;
    238                                
    239                                 case VirtualSystemDescriptionType_BaseFolder:
     238
     239                case VirtualSystemDescriptionType_BaseFolder:
    240240                    pcszType = "basefolder";
    241241                break;
    242                                
    243                                 case VirtualSystemDescriptionType_PrimaryGroup:
     242
     243                case VirtualSystemDescriptionType_PrimaryGroup:
    244244                    pcszType = "primarygroup";
    245245                break;
     
    294294{
    295295    char szSrc[RTPATH_MAX];
    296     char szDst[RTPATH_MAX];
    297296    RTPathExecDir(szSrc, sizeof(szSrc));
    298297    RTPathAppend(szSrc, sizeof(szSrc), "ovf-testcases/ovf-dummy.vmdk");
     298
     299    char szDst[RTPATH_MAX];
    299300    RTPathExecDir(szDst, sizeof(szDst));
    300301    RTPathAppend(szDst, sizeof(szDst), pcszDest);
    301302    RTPrintf("%s: copying ovf-dummy.vmdk to \"%s\"...\n", pcszPrefix, pcszDest);
    302303
    303         if (FILE *file = fopen(pcszDest, "r"))
    304         {
    305                 fclose(file);
    306                 RTFileDelete(pcszDest);
    307         }
     304    /* Delete the destination file if it exists or RTFileCopy will fail. */
     305    if (RTFileExists(szDst))
     306    {
     307        RTPrintf("Deleting file %s...\n", szDst);
     308        RTFileDelete(szDst);
     309    }
    308310
    309311    int vrc = RTFileCopy(szSrc, szDst);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette