Changeset 97426 in vbox for trunk/src/VBox/Main
- Timestamp:
- Nov 7, 2022 7:44:16 AM (2 years ago)
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r97417 r97426 1794 1794 RTPathChangeToUnixSlashes(strTranslated.mutableRaw(), true /* fForce */); 1795 1795 } 1796 else if (enmDstPathStyle == PathStyle_DOS) 1797 { 1798 if ( enmSrcPathStyle == PathStyle_DOS 1799 && fForce) 1800 { 1801 strTranslated = strPath; 1802 RTPathChangeToDosSlashes(strTranslated.mutableRaw(), true /* fForce */); 1803 } 1804 else if (enmSrcPathStyle == PathStyle_UNIX) 1805 { 1806 /** @todo Check for quoted (sub) strings, e.g. '/foo/bar/\ baz' vs . '/foo/bar/"\ baz"'? */ 1807 const char *psz = strPath.c_str(); 1808 size_t const cch = strPath.length(); 1809 size_t off = 0; 1810 while (off < cch) 1811 { 1812 /* Most likely cases first. */ 1813 if (psz[off] == '/') /* Just transform slashes. */ 1814 strTranslated += '\\'; 1815 /* 1816 * Do a mapping of "\", which marks an escape sequence for paths on UNIX-y OSes to DOS-based OSes (like Windows), 1817 * however, on DOS "\" is a path separator. 1818 * 1819 * See @ticketref{21095}. 1820 */ 1821 /** @todo r=bird: Seeing that callers like GuestSessionTaskCopyFrom::Run() has 1822 * passed strPath to RTPathQueryInfoEx() prior to calling this function, I don't 1823 * get the comments about escape sequence stuff here. 1824 * 1825 * "\" ("\\" in C/C++) is not an escape sequence on unix unless you're in a 1826 * typical unix shell like bash. It's just a filename character that doesn't 1827 * get interpreted as anything special by the kernel (unlike '/' and '\0' (C/C++ 1828 * encoding)). 1829 * 1830 * "\ " (or "\\ " in C/C++) does not mark a single space in a path component, it 1831 * signifies two characters, a backslash and a space, neither with any special 1832 * meaning to a UNIX host. 1833 */ 1834 else if (psz[off] == '\\') 1835 { 1836 /* "\ " is valid on UNIX-system and mark a space in a path component. */ 1837 if ( off + 1 <= cch 1838 && psz[off + 1] == ' ') 1839 { 1840 strTranslated += ' '; 1841 off++; /* Skip actual escape sequence char (space in this case). */ 1842 } 1843 else 1844 { 1845 /* Every other escape sequence is not supported and would lead to different paths anyway, so bail out here. */ 1846 vrc = VERR_NOT_SUPPORTED; 1847 break; 1848 } 1849 } 1850 else /* Just add it unmodified. */ 1851 strTranslated += psz[off]; 1852 off++; 1853 } 1854 } 1796 else if ( ( enmSrcPathStyle == PathStyle_UNIX 1797 && enmDstPathStyle == PathStyle_DOS) 1798 || (fForce && enmDstPathStyle == PathStyle_DOS)) 1799 1800 { 1801 strTranslated = strPath; 1802 RTPathChangeToDosSlashes(strTranslated.mutableRaw(), true /* fForce */); 1855 1803 } 1856 1804 … … 1877 1825 if (off + 1 > cch) 1878 1826 break; 1879 /* Remove double slashes. */ 1880 if ( psz[off] == '\\' 1827 /* Remove double back slashes (DOS only). */ 1828 if ( enmDstPathStyle == PathStyle_DOS 1829 && psz[off] == '\\' 1881 1830 && psz[off + 1] == '\\') 1882 1831 { … … 1884 1833 off++; 1885 1834 } 1886 if ( psz[off] == '/' 1835 /* Remove double forward slashes (UNIX only). */ 1836 if ( enmDstPathStyle == PathStyle_UNIX 1837 && psz[off] == '/' 1887 1838 && psz[off + 1] == '/') 1888 1839 { -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r97425 r97426 1726 1726 1727 1727 /* Clean up the final guest source path (for cleaning up mixed path separators). */ 1728 vrc = GuestPath::Translate(strSrcAbs, pList->mSourceSpec.enmPathStyle /* Source */, pList->mSourceSpec.enmPathStyle /* Dest */,1729 true /* fForce*/);1728 vrc = GuestPath::Translate(strSrcAbs, pList->mSourceSpec.enmPathStyle /* Source */, 1729 pList->mSourceSpec.enmPathStyle /* Dest */); 1730 1730 if (RT_FAILURE(vrc)) 1731 1731 { … … 1737 1737 1738 1738 /* Translate the final host destination path. */ 1739 vrc = GuestPath::Translate(strDstAbs, PATH_STYLE_NATIVE /* Source */, PATH_STYLE_NATIVE /* Dest */ , true /* fForce */);1739 vrc = GuestPath::Translate(strDstAbs, PATH_STYLE_NATIVE /* Source */, PATH_STYLE_NATIVE /* Dest */); 1740 1740 if (RT_FAILURE(vrc)) 1741 1741 { … … 2045 2045 /* Translate the destination path to a path compatible with the guest. 2046 2046 * Note: This needs to be done *before* GuestPath::BuildDestinationPath() below! */ 2047 vrc = GuestPath::Translate(strDstRootAbs, 2048 mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */, 2049 true /* fForce */); 2047 vrc = GuestPath::Translate(strDstRootAbs, mSession->i_getGuestPathStyle() /* Source */, 2048 mSession->i_getGuestPathStyle() /* Dest */); 2050 2049 2051 2050 GuestPath::BuildDestinationPath(strSrcRootAbs, PATH_STYLE_NATIVE, … … 2161 2160 /* Clean up the final guest destination root path (for cleaning up mixed path separators). */ 2162 2161 vrc = GuestPath::Translate(strDstRootAbs, 2163 mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */, 2164 true /* fForce */); 2162 mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */); 2165 2163 if (RT_FAILURE(vrc)) 2166 2164 { … … 2198 2196 2199 2197 /* Clean up the final host source path (for cleaning up mixed path separators). */ 2200 vrc = GuestPath::Translate(strSrcAbs, 2201 PATH_STYLE_NATIVE /* Source */, PATH_STYLE_NATIVE /* Dest */, 2202 true /* fForce */); 2198 vrc = GuestPath::Translate(strSrcAbs, PATH_STYLE_NATIVE /* Source */, PATH_STYLE_NATIVE /* Dest */); 2203 2199 if (RT_FAILURE(vrc)) 2204 2200 { … … 2211 2207 /* Translate the final guest destination path. */ 2212 2208 vrc = GuestPath::Translate(strDstAbs, 2213 mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */, 2214 true /* fForce */); 2209 mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */); 2215 2210 if (RT_FAILURE(vrc)) 2216 2211 { … … 2302 2297 2303 2298 /* Cleanup the destination path. */ 2304 vrc = GuestPath::Translate(strDstRootAbs, mSession->i_getGuestPathStyle() /* Source */,2305 mSession->i_getGuestPathStyle() /* Dest */, true /* fForce*/);2299 vrc = GuestPath::Translate(strDstRootAbs, 2300 mSession->i_getGuestPathStyle() /* Source */, mSession->i_getGuestPathStyle() /* Dest */); 2306 2301 if (RT_FAILURE(vrc)) 2307 2302 {
Note:
See TracChangeset
for help on using the changeset viewer.