Changeset 92544 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Nov 22, 2021 10:31:09 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r91745 r92544 1001 1001 mSourceSpec = SourceSpec; 1002 1002 1003 /* If the source is a directory, make sure the path is properly terminated already. */ 1004 if (mSourceSpec.enmType == FsObjType_Directory) 1005 { 1006 LogFlowFunc(("Directory: mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x, fFollowSymlinks=%RTbool, fRecursive=%RTbool\n", 1007 mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.Dir.fCopyFlags, 1008 mSourceSpec.Type.Dir.fFollowSymlinks, mSourceSpec.Type.Dir.fRecursive)); 1009 1010 if ( !mSrcRootAbs.endsWith("/") 1011 && !mSrcRootAbs.endsWith("\\")) 1012 mSrcRootAbs += "/"; 1013 1014 if ( !mDstRootAbs.endsWith("/") 1015 && !mDstRootAbs.endsWith("\\")) 1016 mDstRootAbs += "/"; 1017 } 1018 else if (mSourceSpec.enmType == FsObjType_File) 1019 { 1020 LogFlowFunc(("File: mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x\n", 1021 mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.File.fCopyFlags)); 1022 } 1023 else 1024 AssertFailedReturn(VERR_NOT_IMPLEMENTED); 1003 /* Note: Leave the source and dest roots unmodified -- how paths will be treated 1004 * will be done directly when working on those. See @bugref{10139}. */ 1005 1006 LogFlowFunc(("mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x, fFollowSymlinks=%RTbool, fRecursive=%RTbool\n", 1007 mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.Dir.fCopyFlags, 1008 mSourceSpec.Type.Dir.fFollowSymlinks, mSourceSpec.Type.Dir.fRecursive)); 1025 1009 1026 1010 return VINF_SUCCESS; … … 1579 1563 } 1580 1564 1565 char szPath[RTPATH_MAX]; 1566 1581 1567 FsEntries::const_iterator itEntry = pList->mVecEntries.begin(); 1582 1568 while (itEntry != pList->mVecEntries.end()) … … 1587 1573 Utf8Str strSrcAbs = pList->mSrcRootAbs; 1588 1574 Utf8Str strDstAbs = pList->mDstRootAbs; 1575 1576 LogFlowFunc(("Entry: srcRootAbs=%s, dstRootAbs=%s\n", pList->mSrcRootAbs.c_str(), pList->mDstRootAbs.c_str())); 1577 1589 1578 if (pList->mSourceSpec.enmType == FsObjType_Directory) 1590 1579 { 1591 strSrcAbs += pEntry->strPath; 1592 strDstAbs += pEntry->strPath; 1593 1594 if (pList->mSourceSpec.enmPathStyle == PathStyle_DOS) 1595 strDstAbs.findReplace('\\', '/'); 1596 } 1580 /* Build the source path on the guest. */ 1581 rc = RTStrCopy(szPath, sizeof(szPath), pList->mSrcRootAbs.c_str()); 1582 if (RT_SUCCESS(rc)) 1583 { 1584 rc = RTPathAppend(szPath, sizeof(szPath), pEntry->strPath.c_str()); 1585 if (RT_SUCCESS(rc)) 1586 strSrcAbs = szPath; 1587 } 1588 1589 /* Build the destination path on the host. */ 1590 rc = RTStrCopy(szPath, sizeof(szPath), pList->mDstRootAbs.c_str()); 1591 if (RT_SUCCESS(rc)) 1592 { 1593 rc = RTPathAppend(szPath, sizeof(szPath), pEntry->strPath.c_str()); 1594 if (RT_SUCCESS(rc)) 1595 strDstAbs = szPath; 1596 } 1597 } 1598 1599 if (pList->mSourceSpec.enmPathStyle == PathStyle_DOS) 1600 strDstAbs.findReplace('\\', '/'); 1597 1601 1598 1602 mProgress->SetNextOperation(Bstr(strSrcAbs).raw(), 1); 1603 1604 LogRel2(("Guest Control: Copying '%s' from guest to '%s' on host ...\n", strSrcAbs.c_str(), strDstAbs.c_str())); 1599 1605 1600 1606 switch (pEntry->fMode & RTFS_TYPE_MASK) … … 1827 1833 default: 1828 1834 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1829 Utf8StrFmt(tr("Querying information on for '%s' failed: %Rrc"),1835 Utf8StrFmt(tr("Querying information on guest for '%s' failed: %Rrc"), 1830 1836 strDstRootAbs.c_str(), rcGuest)); 1831 1837 break; … … 1841 1847 } 1842 1848 1849 char szPath[RTPATH_MAX]; 1850 1843 1851 LogFlowFunc(("List inital: rc=%Rrc, srcRootAbs=%s, dstRootAbs=%s\n", 1844 1852 rc, strSrcRootAbs.c_str(), strDstRootAbs.c_str())); … … 1857 1865 1858 1866 /* If the directory on the guest already exists, append the name of the root source directory to it. */ 1859 if (dstObjData.mType == FsObjType_Directory) 1860 { 1861 if (fCopyIntoExisting) 1862 { 1863 if ( !strDstRootAbs.endsWith("/") 1864 && !strDstRootAbs.endsWith("\\")) 1865 strDstRootAbs += "/"; 1866 strDstRootAbs += Utf8Str(RTPathFilenameEx(strSrcRootAbs.c_str(), mfPathStyle)); 1867 } 1868 else 1869 { 1867 switch (dstObjData.mType) 1868 { 1869 case FsObjType_Directory: 1870 { 1871 if (fCopyIntoExisting) 1872 { 1873 /* Build the destination path on the guest. */ 1874 rc = RTStrCopy(szPath, sizeof(szPath), strDstRootAbs.c_str()); 1875 if (RT_SUCCESS(rc)) 1876 { 1877 rc = RTPathAppend(szPath, sizeof(szPath), RTPathFilenameEx(strSrcRootAbs.c_str(), mfPathStyle)); 1878 if (RT_SUCCESS(rc)) 1879 strDstRootAbs = szPath; 1880 } 1881 } 1882 else 1883 { 1884 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1885 Utf8StrFmt(tr("Guest directory \"%s\" already exists"), 1886 strDstRootAbs.c_str())); 1887 rc = VERR_ALREADY_EXISTS; 1888 } 1889 break; 1890 } 1891 1892 case FsObjType_File: 1893 /* Nothing to do. */ 1894 break; 1895 1896 default: 1870 1897 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1871 Utf8StrFmt(tr(" Guest directory \"%s\" already exists"),1898 Utf8StrFmt(tr("Unknown object type on guest for \"%s\""), 1872 1899 strDstRootAbs.c_str())); 1873 rc = VERR_ ALREADY_EXISTS;1874 }1900 rc = VERR_NOT_SUPPORTED; 1901 break; 1875 1902 } 1876 1903 … … 1898 1925 AssertFailedStmt(rc = VERR_NOT_SUPPORTED); 1899 1926 1927 LogFlowFunc(("List final: rc=%Rrc, srcRootAbs=%s, dstRootAbs=%s, fFileCopyFlags=%#x\n", 1928 rc, strSrcRootAbs.c_str(), strDstRootAbs.c_str(), fFileCopyFlags)); 1929 1930 LogRel2(("Guest Control: Copying '%s' from host to '%s' on guest ...\n", strSrcRootAbs.c_str(), strDstRootAbs.c_str())); 1931 1900 1932 if (RT_FAILURE(rc)) 1901 1933 break; 1902 1903 LogFlowFunc(("List final: rc=%Rrc, srcRootAbs=%s, dstRootAbs=%s, fFileCopyFlags=%#x\n",1904 rc, strSrcRootAbs.c_str(), strDstRootAbs.c_str(), fFileCopyFlags));1905 1906 LogRel2(("Guest Control: Copying '%s' from host to '%s' on guest ...\n", strSrcRootAbs.c_str(), strDstRootAbs.c_str()));1907 1934 1908 1935 FsEntries::const_iterator itEntry = pList->mVecEntries.begin(); … … 1918 1945 if (pList->mSourceSpec.enmType == FsObjType_Directory) 1919 1946 { 1920 if ( !strSrcAbs.endsWith("/") 1921 && !strSrcAbs.endsWith("\\")) 1922 strSrcAbs += "/"; 1923 strSrcAbs += pEntry->strPath; 1947 /* Build the final (absolute) source path (on the host). */ 1948 rc = RTStrCopy(szPath, sizeof(szPath), strSrcAbs.c_str()); 1949 if (RT_SUCCESS(rc)) 1950 { 1951 rc = RTPathAppend(szPath, sizeof(szPath), pEntry->strPath.c_str()); 1952 if (RT_SUCCESS(rc)) 1953 strSrcAbs = szPath; 1954 } 1955 1956 if (RT_FAILURE(rc)) 1957 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1958 Utf8StrFmt(tr("Building source host path for entry \"%s\" failed (%Rrc)"), 1959 pEntry->strPath.c_str(), rc)); 1924 1960 } 1925 1961 … … 1927 1963 if (dstObjData.mType == FsObjType_Directory) 1928 1964 { 1929 if ( !strDstAbs.endsWith("/") 1930 && !strDstAbs.endsWith("\\")) 1931 strDstAbs += "/"; 1932 strDstAbs += pEntry->strPath; 1965 /* Build the final (absolute) destination path (on the guest). */ 1966 rc = RTStrCopy(szPath, sizeof(szPath), strDstAbs.c_str()); 1967 if (RT_SUCCESS(rc)) 1968 { 1969 rc = RTPathAppend(szPath, sizeof(szPath), pEntry->strPath.c_str()); 1970 if (RT_SUCCESS(rc)) 1971 strDstAbs = szPath; 1972 } 1973 1974 if (RT_FAILURE(rc)) 1975 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1976 Utf8StrFmt(tr("Building destination guest path for entry \"%s\" failed (%Rrc)"), 1977 pEntry->strPath.c_str(), rc)); 1933 1978 } 1934 1979 1935 1980 mProgress->SetNextOperation(Bstr(strSrcAbs).raw(), 1); 1936 1981 1937 LogFlowFunc(("strEntry='%s'\n", pEntry->strPath.c_str())); 1938 LogFlowFunc(("\tsrcAbs='%s'\n", strSrcAbs.c_str())); 1939 LogFlowFunc(("\tdstAbs='%s'\n", strDstAbs.c_str())); 1982 LogRel2(("Guest Control: Copying '%s' from host to '%s' on guest ...\n", strSrcAbs.c_str(), strDstAbs.c_str())); 1940 1983 1941 1984 switch (pEntry->fMode & RTFS_TYPE_MASK)
Note:
See TracChangeset
for help on using the changeset viewer.