VirtualBox

Changeset 97531 in vbox


Ignore:
Timestamp:
Nov 14, 2022 2:02:16 PM (2 years ago)
Author:
vboxsync
Message:

Guest Control/Main: A bit less code wrt translating paths. bugref:10286

File:
1 edited

Legend:

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

    r97485 r97531  
    16421642        Utf8Str strDstRootAbs = pList->mDstRootAbs;
    16431643
    1644         GuestPath::BuildDestinationPath(strSrcRootAbs, mSession->i_getGuestPathStyle(),
    1645                                         strDstRootAbs, PATH_STYLE_NATIVE);
     1644        vrc = GuestPath::BuildDestinationPath(strSrcRootAbs, mSession->i_getGuestPathStyle() /* Source */,
     1645                                              strDstRootAbs, PATH_STYLE_NATIVE  /* Dest */);
     1646        if (RT_FAILURE(vrc))
     1647        {
     1648            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
     1649                                Utf8StrFmt(tr("Building host destination root path \"%s\" failed: %Rrc"),
     1650                                           strDstRootAbs.c_str(), vrc));
     1651            break;
     1652        }
    16461653
    16471654        bool fCopyIntoExisting;
     
    17311738                break;
    17321739
    1733             /* Clean up the final host destination root path (for cleaning up mixed path separators). */
    1734             vrc = GuestPath::Translate(strDstRootAbs,
    1735                                        PATH_STYLE_NATIVE /* Source */, PATH_STYLE_NATIVE /* Dest */);
    1736             if (RT_FAILURE(vrc))
    1737             {
    1738                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    1739                                     Utf8StrFmt(tr("Translating host destination root path \"%s\" failed: %Rrc"),
    1740                                                strDstRootAbs.c_str(), vrc));
    1741                 break;
    1742             }
    1743 
    17441740            /* Make sure the destination root directory exists. */
    17451741            if (pList->mSourceSpec.fDryRun == false)
     
    17681764                strDstAbs += pEntry->strPath;
    17691765
    1770                 /* Clean up the final guest source path (for cleaning up mixed path separators). */
     1766                /* Clean up the final guest source path. */
    17711767                vrc = GuestPath::Translate(strSrcAbs, pList->mSourceSpec.enmPathStyle /* Source */,
    17721768                                           pList->mSourceSpec.enmPathStyle /* Dest */);
     
    17791775                }
    17801776
    1781                 /* Translate the final host destination path. */
     1777                /* Clean up the final host desitnation path. */
    17821778                vrc = GuestPath::Translate(strDstAbs, PATH_STYLE_NATIVE /* Source */, PATH_STYLE_NATIVE /* Dest */);
    17831779                if (RT_FAILURE(vrc))
     
    21052101        Utf8Str strDstRootAbs = pList->mDstRootAbs;
    21062102
    2107         /* Translate the destination path to a path compatible with the guest.
    2108          * Note: This needs to be done *before* GuestPath::BuildDestinationPath() below! */
    2109         vrc = GuestPath::Translate(strDstRootAbs, mSession->i_getGuestPathStyle() /* Source */,
    2110                                    mSession->i_getGuestPathStyle() /* Dest */);
    2111 
    2112         GuestPath::BuildDestinationPath(strSrcRootAbs, PATH_STYLE_NATIVE,
    2113                                         strDstRootAbs, mSession->i_getGuestPathStyle());
    2114 
    2115 
     2103        vrc = GuestPath::BuildDestinationPath(strSrcRootAbs, PATH_STYLE_NATIVE /* Source */,
     2104                                              strDstRootAbs, mSession->i_getGuestPathStyle()  /* Dest */);
    21162105        if (RT_FAILURE(vrc))
    21172106        {
    21182107            setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2119                                 Utf8StrFmt(tr("Translating guest destination path \"%s\" failed: %Rrc"),
     2108                                Utf8StrFmt(tr("Building guest destination root path \"%s\" failed: %Rrc"),
    21202109                                           strDstRootAbs.c_str(), vrc));
    21212110            break;
     
    22212210                break;
    22222211
    2223             /* Clean up the final guest destination root path (for cleaning up mixed path separators). */
    2224             vrc = GuestPath::Translate(strDstRootAbs,
    2225                                        mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */);
    2226             if (RT_FAILURE(vrc))
    2227             {
    2228                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    2229                                     Utf8StrFmt(tr("Translating guest destination root path \"%s\" failed: %Rrc"),
    2230                                                strDstRootAbs.c_str(), vrc));
    2231                 break;
    2232             }
    2233 
    22342212            /* Make sure the destination root directory exists. */
    22352213            if (pList->mSourceSpec.fDryRun == false)
     
    22582236                strDstAbs += pEntry->strPath;
    22592237
    2260                 /* Clean up the final host source path (for cleaning up mixed path separators). */
     2238                /* Clean up the final host source path. */
    22612239                vrc = GuestPath::Translate(strSrcAbs, PATH_STYLE_NATIVE /* Source */, PATH_STYLE_NATIVE /* Dest */);
    22622240                if (RT_FAILURE(vrc))
     
    22682246                }
    22692247
    2270                 /* Translate the final guest destination path. */
     2248                /* Clean up the final guest destination path. */
    22712249                vrc = GuestPath::Translate(strDstAbs,
    22722250                                           mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */);
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