VirtualBox

Ignore:
Timestamp:
Aug 10, 2011 11:48:29 AM (13 years ago)
Author:
vboxsync
Message:

GuestCtrl: Update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r38290 r38395  
    7979
    8080/**
    81  * An entry for a source element, including an optional filter.
     81 * An entry for a source element, including an optional DOS-like wildcard (*,?).
    8282 */
    8383typedef struct SOURCEFILEENTRY
     
    9393        {
    9494            /* No file and no directory -- maybe a filter? */
    95             if (NULL != strpbrk(RTPathFilename(pszSource), "*?"))
     95            char *pszFilename = RTPathFilename(pszSource);
     96            if (   pszFilename
     97                && strpbrk(pszFilename, "*?"))
    9698            {
    9799                /* Yep, get the actual filter part. */
     
    938940    {
    939941        BOOL fDirExists = FALSE;
    940         HRESULT hr = pContext->pGuest->FileExists(Bstr(pszDir).raw(),
    941                                                   Bstr(pContext->pszUsername).raw(),
    942                                                   Bstr(pContext->pszPassword).raw(), &fDirExists);
     942        HRESULT hr = pContext->pGuest->DirectoryExists(Bstr(pszDir).raw(),
     943                                                       Bstr(pContext->pszUsername).raw(),
     944                                                       Bstr(pContext->pszPassword).raw(), &fDirExists);
    943945        if (FAILED(hr))
    944946            rc = ctrlPrintError(pContext->pGuest, COM_IIDOF(IGuest));
     
    12711273                case GuestDirEntryType_File:
    12721274                {
    1273                     const char *pszName = Utf8Str(strName).c_str();
     1275                    Utf8Str strFile(strName);
    12741276                    if (   !pszFilter
    1275                         || RTStrSimplePatternMatch(pszFilter, pszName))
     1277                        || RTStrSimplePatternMatch(pszFilter, strFile.c_str()))
    12761278                    {
    12771279                        if (!fDirCreated)
     
    12911293                        if (RT_SUCCESS(rc))
    12921294                        {
    1293                             Utf8Str strDir(strName);
    12941295                            char *pszFileSource;
    12951296                            if (RTStrAPrintf(&pszFileSource, "%s/%s",
    1296                                              szCurDir, strDir.c_str()))
     1297                                             szCurDir, strFile.c_str()))
    12971298                            {
    12981299                                char *pszFileDest;
     
    13071308                                RTStrFree(pszFileSource);
    13081309                            }
     1310                            else
     1311                                rc = VERR_NO_MEMORY;
    13091312                        }
    13101313                    }
     
    13151318                    break;
    13161319            }
    1317         }
    1318 
    1319         hr = pContext->pGuest->DirectoryClose(uDirHandle);
    1320         if (FAILED(rc))
    1321             rc = ctrlPrintError(pContext->pGuest, COM_IIDOF(IGuest));
     1320
     1321            if (RT_FAILURE(rc))
     1322                break;
     1323        }
     1324
     1325        if (FAILED(hr))
     1326        {
     1327            if (hr != E_ABORT)
     1328                rc = ctrlPrintError(pContext->pGuest, COM_IIDOF(IGuest));
     1329        }
     1330
     1331        HRESULT hr2 = pContext->pGuest->DirectoryClose(uDirHandle);
     1332        if (FAILED(hr2))
     1333        {
     1334            int rc2 = ctrlPrintError(pContext->pGuest, COM_IIDOF(IGuest));
     1335            if (RT_SUCCESS(rc))
     1336                rc = rc2;
     1337        }
     1338        else if (SUCCEEDED(hr))
     1339            hr = hr2;
    13221340    }
    13231341
     
    15491567                RTPrintf("Source: %s\n", pszSource);
    15501568
    1551             /* @todo Files with filter?? */
     1569            /** @todo Files with filter?? */
    15521570            bool fExists;
    15531571            vrc = ctrlCopyFileExistsOnSource(pContext, pszSource, &fExists);
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