VirtualBox

Changeset 97417 in vbox


Ignore:
Timestamp:
Nov 6, 2022 10:31:19 AM (2 years ago)
Author:
vboxsync
Message:

Guest Control/Main: More path building / translation fixes. ​bugref:10286

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h

    r97395 r97417  
    13881388};
    13891389
     1390/** Returns the path separator based on \a a_enmPathStyle as a C-string. */
     1391#define PATH_STYLE_SEP_STR(a_enmPathStyle) a_enmPathStyle == PathStyle_DOS ? "\\" : "/"
     1392#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
     1393# define PATH_STYLE_NATIVE               PathStyle_DOS
     1394#else
     1395# define PATH_STYLE_NATIVE               PathStyle_UNIX
     1396#endif
     1397
    13901398/**
    13911399 * Class for handling guest / host path functions.
  • trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp

    r97415 r97417  
    17501750    else if (pszSrcName && !pszDstName) /* #2 */
    17511751    {
    1752         strDstPath += RTPATH_SLASH_STR;
     1752        if (!strDstPath.endsWith(PATH_STYLE_SEP_STR(enmDstPathStyle)))
     1753            strDstPath += PATH_STYLE_SEP_STR(enmDstPathStyle);
    17531754        strDstPath += pszSrcName;
    17541755    }
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r97414 r97417  
    7474#define ISOFILE_FLAG_OPTIONAL            RT_BIT(8)
    7575
    76 
    77 /** Returns the path separator based on \a a_enmPathStyle as a C-string. */
    78 #define PATH_STYLE_SEP_STR(a_enmPathStyle) a_enmPathStyle == PathStyle_DOS ? "\\" : "/"
    79 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
    80 # define PATH_STYLE_NATIVE               PathStyle_DOS
    81 #else
    82 # define PATH_STYLE_NATIVE               PathStyle_UNIX
    83 #endif
    8476
    8577// session task classes
     
    20512043        Utf8Str strDstRootAbs = pList->mDstRootAbs;
    20522044
    2053         GuestPath::BuildDestinationPath(strSrcRootAbs, PATH_STYLE_NATIVE,
    2054                                         strDstRootAbs, mSession->i_getGuestPathStyle());
    2055 
    2056         /* Translate the destination path from the host to a path compatible with the guest.
    2057          * strDstRootAbs already is in the destination path style, so just do a path cleanup. */
     2045        /* Translate the destination path to a path compatible with the guest.
     2046         * Note: This needs to be done *before* GuestPath::BuildDestinationPath() below! */
    20582047        vrc = GuestPath::Translate(strDstRootAbs,
    20592048                                   mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */,
    20602049                                   true /* fForce */);
     2050
     2051        GuestPath::BuildDestinationPath(strSrcRootAbs, PATH_STYLE_NATIVE,
     2052                                        strDstRootAbs, mSession->i_getGuestPathStyle());
     2053
     2054
    20612055        if (RT_FAILURE(vrc))
    20622056        {
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