VirtualBox

Changeset 92822 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Dec 8, 2021 2:55:45 PM (3 years ago)
Author:
vboxsync
Message:

Guest Control: Resolved a @todo: Implemented DirectoryCopyFlag_Recursive + DirectoryCopyFlag_FollowLinks and no longer do this implicitly internally.

Location:
trunk/src/VBox/Main/src-client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r92817 r92822  
    869869                if (MATCH_KEYWORD("CopyIntoExisting"))
    870870                    fFlags |= (unsigned)DirectoryCopyFlag_CopyIntoExisting;
     871                else if (MATCH_KEYWORD("Recursive"))
     872                    fFlags |= (unsigned)DirectoryCopyFlag_Recursive;
     873                else if (MATCH_KEYWORD("FollowLinks"))
     874                    fFlags |= (unsigned)DirectoryCopyFlag_FollowLinks;
    871875                else
    872876                    return setError(E_INVALIDARG, tr("Invalid directory copy flag: %.*s"), (int)cchKeyword, pszNext);
     
    32013205        {
    32023206            hrc = GuestSession::i_directoryCopyFlagFromStr(strFlags, &source.Type.Dir.fCopyFlags);
    3203             source.Type.Dir.fRecursive = true; /* Implicit. */
    32043207        }
    32053208        else if (source.enmType == FsObjType_File)
    32063209            hrc = GuestSession::i_fileCopyFlagFromStr(strFlags, &source.Type.File.fCopyFlags);
    32073210        else
    3208             return setError(E_INVALIDARG, tr("Source type %d invalid / not supported"), source.enmType);
     3211            return setError(E_INVALIDARG, tr("Source type %#x invalid / not supported"), source.enmType);
    32093212        if (FAILED(hrc))
    32103213            return hrc;
     
    32723275        {
    32733276            hrc = GuestSession::i_directoryCopyFlagFromStr(strFlags, &source.Type.Dir.fCopyFlags);
    3274             source.Type.Dir.fFollowSymlinks = true; /** @todo Add a flag for that in DirectoryCopyFlag_T. Later. */
    3275             source.Type.Dir.fRecursive      = true; /* Implicit. */
    32763277        }
    32773278        else if (source.enmType == FsObjType_File)
    32783279            hrc = GuestSession::i_fileCopyFlagFromStr(strFlags, &source.Type.File.fCopyFlags);
    32793280        else
    3280             return setError(E_INVALIDARG, tr("Source type %d invalid / not supported"), source.enmType);
     3281            return setError(E_INVALIDARG, tr("Source type %#x invalid / not supported"), source.enmType);
    32813282        if (FAILED(hrc))
    32823283            return hrc;
     
    33143315            fFlags |= aFlags[i];
    33153316
    3316         const uint32_t fValidFlags = DirectoryCopyFlag_None | DirectoryCopyFlag_CopyIntoExisting;
     3317        const uint32_t fValidFlags =   DirectoryCopyFlag_None | DirectoryCopyFlag_CopyIntoExisting | DirectoryCopyFlag_Recursive
     3318                                     | DirectoryCopyFlag_FollowLinks;
    33173319        if (fFlags & ~fValidFlags)
    33183320            return setError(E_INVALIDARG,tr("Unknown flags: flags value %#x, invalid: %#x"), fFlags, fFlags & ~fValidFlags);
     
    33273329    source.fDryRun              = false; /** @todo Implement support for a dry run. */
    33283330    source.Type.Dir.fCopyFlags  = (DirectoryCopyFlag_T)fFlags;
    3329     source.Type.Dir.fRecursive  = true; /* Implicit. */
    33303331
    33313332    SourceSet.push_back(source);
     
    33433344            fFlags |= aFlags[i];
    33443345
    3345         const uint32_t fValidFlags = DirectoryCopyFlag_None | DirectoryCopyFlag_CopyIntoExisting;
     3346        const uint32_t fValidFlags =   DirectoryCopyFlag_None | DirectoryCopyFlag_CopyIntoExisting | DirectoryCopyFlag_Recursive
     3347                                     | DirectoryCopyFlag_FollowLinks;
    33463348        if (fFlags & ~fValidFlags)
    33473349            return setError(E_INVALIDARG,tr("Unknown flags: flags value %#x, invalid: %#x"), fFlags, fFlags & ~fValidFlags);
     
    33563358    source.fDryRun             = false; /** @todo Implement support for a dry run. */
    33573359    source.Type.Dir.fCopyFlags = (DirectoryCopyFlag_T)fFlags;
    3358     source.Type.Dir.fFollowSymlinks = true; /** @todo Add a flag for that in DirectoryCopyFlag_T. Later. */
    3359     source.Type.Dir.fRecursive      = true; /* Implicit. */
    33603360
    33613361    SourceSet.push_back(source);
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r92715 r92822  
    10041004     *       will be done directly when working on those. See @bugref{10139}. */
    10051005
    1006     LogFlowFunc(("mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x, fFollowSymlinks=%RTbool, fRecursive=%RTbool\n",
    1007                  mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.Dir.fCopyFlags,
    1008                  mSourceSpec.Type.Dir.fFollowSymlinks, mSourceSpec.Type.Dir.fRecursive));
     1006    LogFlowFunc(("mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x\n",
     1007                 mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.Dir.fCopyFlags));
    10091008
    10101009    return VINF_SUCCESS;
     
    11231122                    LogRel2(("Guest Control: Directory '%s'\n", strEntry.c_str()));
    11241123
    1125                     if (!(mSourceSpec.Type.Dir.fRecursive))
     1124                    if (!(mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_Recursive))
    11261125                        break;
    11271126
     
    11321131                case FsObjType_Symlink:
    11331132                {
    1134                     if (mSourceSpec.Type.Dir.fFollowSymlinks)
     1133                    if (mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks)
    11351134                    {
    11361135                        /** @todo Symlink handling from guest is not implemented yet.
     
    12341233                                LogRel2(("Guest Control: Directory '%s'\n", strEntry.c_str()));
    12351234
    1236                                 if (!(mSourceSpec.Type.Dir.fRecursive))
     1235                                if (!(mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_Recursive))
    12371236                                    break;
    12381237
     
    12511250                            case RTFS_TYPE_SYMLINK:
    12521251                            {
    1253                                 if (mSourceSpec.Type.Dir.fFollowSymlinks)
     1252                                if (mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks)
    12541253                                {
    12551254                                    Utf8Str strEntryAbs = strPathAbs + Utf8Str(Entry.szName);
     
    14431442                }
    14441443
    1445                 fFollowSymlinks = itSrc->Type.Dir.fFollowSymlinks;
     1444                fFollowSymlinks = itSrc->Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks;
    14461445            }
    14471446            else
     
    18381837        GuestFsObjData dstObjData;
    18391838        int rcGuest;
    1840         rc = mSession->i_fsQueryInfo(strDstRootAbs, pList->mSourceSpec.Type.Dir.fFollowSymlinks, dstObjData, &rcGuest);
     1839        rc = mSession->i_fsQueryInfo(strDstRootAbs, pList->mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks,
     1840                                     dstObjData, &rcGuest);
    18411841        if (RT_FAILURE(rc))
    18421842        {
     
    18791879        {
    18801880            fCopyIntoExisting = RT_BOOL(pList->mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_CopyIntoExisting);
    1881             fFollowSymlinks   = pList->mSourceSpec.Type.Dir.fFollowSymlinks;
     1881            fFollowSymlinks   = RT_BOOL(pList->mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks);
    18821882
    18831883            LogFlowFunc(("Directory: fDirCopyFlags=%#x, fCopyIntoExisting=%RTbool, fFollowSymlinks=%RTbool\n",
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