VirtualBox

Ignore:
Timestamp:
Feb 20, 2024 3:21:35 PM (12 months ago)
Author:
vboxsync
Message:

Shared Clipboard: Added a ShClTransferTransformPath() function to make the paths more uniform. bugref:9437

Location:
trunk/src/VBox/GuestHost/SharedClipboard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp

    r100665 r103480  
    3838
    3939#include <VBox/GuestHost/SharedClipboard.h>
     40#include <VBox/GuestHost/SharedClipboard-transfers.h>
    4041#include <VBox/GuestHost/SharedClipboard-win.h>
    4142
     
    211212            rc = RTStrCopy(openParms.pszPath, openParms.cbPath, m_strPath.c_str());
    212213            if (RT_SUCCESS(rc))
    213                 rc = ShClTransferObjOpen(m_pTransfer, &openParms, &m_hObj);
     214            {
     215                rc = ShClTransferTransformPath(openParms.pszPath, openParms.cbPath);
     216                if (RT_SUCCESS(rc))
     217                    rc = ShClTransferObjOpen(m_pTransfer, &openParms, &m_hObj);
     218            }
    214219
    215220            ShClTransferObjOpenParmsDestroy(&openParms);
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp

    r103477 r103480  
    33683368    }
    33693369    return "Unknown";
     3370}
     3371
     3372/**
     3373 * Transforms a path so that it can be sent over to the other party.
     3374 *
     3375 * @returns VBox status code.
     3376 * @param   pszPath             Path to transform. Will be modified in place.
     3377 * @param   cbPath              Size (in bytes) of \a pszPath.
     3378 *
     3379 * @note    Shared Clipboard file paths always are sent over as UNIX-style paths.
     3380 *          Sending over back slashes ('\') could happen on non-Windows OSes as part of a path or file name.
     3381 */
     3382int ShClTransferTransformPath(char *pszPath, size_t cbPath)
     3383{
     3384#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
     3385    RT_NOREF(cbPath);
     3386    RTPathChangeToUnixSlashes(pszPath, true /* fForce */);
     3387#else
     3388    RT_NOREF(pszPath, cbPath);
     3389#endif
     3390    return VINF_SUCCESS;
    33703391}
    33713392
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