VirtualBox

Ignore:
Timestamp:
Nov 4, 2022 11:17:21 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154395
Message:

Guest Control/Main: Rewrite of the path building and directory walking code for the copyFrom / copyTo guest session tasks, to (hopefully) have a cleaner structure. The new path building now also takes into account whether a destination has a trailing delimiter and then act accordingly (see rules in GuestPath::BuildDestinationPath()). Adjusted VBoxManage and FE/Qt to also reflect that; should now work as common tools like cp. Added new test cases and also re-enabled old ones which were disabled since quite a while (should pass now). ​bugref:10286

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp

    r96407 r97395  
    694694         * into existing directories on the guest. This otherwise would fail (default): */
    695695        else if (enmFileType == KFsObjType_Directory)
     696        {
     697            /* Make sure that if the source is a directory, that we append a trailing delimiter to it,
     698             * so that it gets copied *into* the destination directory as a whole, and not just it's contents. */
     699            strDestinationPath = UIPathOperations::addTrailingDelimiters(strDestinationPath);
    696700            aFlags << strDirectoryFlags;
     701        }
    697702        else
    698703            aFlags << strFileFlags;
     
    744749    }
    745750
     751    QString strDestinationPath = hostDestinationPath;
    746752    QString strDirectoryFlags("CopyIntoExisting,Recursive,FollowLinks");
    747753    QString strFileFlags;
     
    760766
    761767        if (fileType(fileInfo) == KFsObjType_Directory)
     768        {
     769            /* Make sure that if the source is a directory, that we append a trailing delimiter to the destination,
     770             * so that the source directory gets copied *into* the destination directory as a whole, and not
     771             * just it's contents. */
     772            strDestinationPath = UIPathOperations::addTrailingDelimiters(strDestinationPath);
    762773            aFlags << strDirectoryFlags;
     774        }
    763775        else
    764776            aFlags << strFileFlags;
    765777    }
    766778
    767     CProgress progress = m_comGuestSession.CopyFromGuest(sourcePaths, aFilters, aFlags, hostDestinationPath);
     779    CProgress progress = m_comGuestSession.CopyFromGuest(sourcePaths, aFilters, aFlags, strDestinationPath);
    768780    if (!checkGuestSession())
    769781        return;
Note: See TracChangeset for help on using the changeset viewer.

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