Changeset 83336 in vbox for trunk/src/VBox/Main
- Timestamp:
- Mar 19, 2020 4:44:56 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 136532
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestSessionImplTasks.h
r82968 r83336 47 47 : enmType(FsObjType_Unknown) 48 48 , enmPathStyle(PathStyle_Unknown) 49 , fDryRun(false) { } /** @todo r=bird: only half initialized. See comments in GuestSession::fileCopyToGuest(). */ 50 49 , fDryRun(false) { RT_ZERO(Type); } 50 51 /** The (absolute) path to the source to use. */ 51 52 Utf8Str strSource; 53 /** Filter to use. Currently not implemented and thus ignored. */ 52 54 Utf8Str strFilter; 55 /** The object type of this source. */ 53 56 FsObjType_T enmType; 57 /** The path style to use. */ 54 58 PathStyle_T enmPathStyle; 59 /** Whether to do a dry run (e.g. not really touching anything) or not. */ 55 60 bool fDryRun; 61 /** Union to keep type-specific data. Must be a POD type (zero'ing). */ 56 62 union 57 63 { … … 61 67 /** Directory copy flags. */ 62 68 DirectoryCopyFlag_T fCopyFlags; 69 /** Whether to follow symbolic links or not. */ 63 70 bool fFollowSymlinks; /** @todo Remove once we have that parameter in DirectoryCopyFlag_T. */ 71 /** Whether to copy the directory recursively or not. */ 64 72 bool fRecursive; 65 73 } Dir; … … 69 77 /** File copy flags. */ 70 78 FileCopyFlag_T fCopyFlags; 79 /** Source file offset to start copying from. */ 80 size_t offStart; 71 81 /** Host file handle to use for reading from / writing to. 72 82 * Optional and can be NULL if not used. */ 73 83 PRTFILE phFile; 74 /** Source file offset to start copying from. */75 size_t offStart;76 84 /** Source size (in bytes) to copy. */ 77 85 uint64_t cbSize; -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r83323 r83336 3037 3037 GuestSessionFsSourceSet SourceSet; 3038 3038 3039 /** @todo r=bird: The GuestSessionFsSourceSpec constructor does not zero the3040 * members you aren't setting here and there are no hints about "input"3041 * vs "task" members, so you have me worrying about using random stack by3042 * accident somewhere... For instance Type.File.phFile sure sounds like3043 * an input field and thus a disaster waiting to happen. */3044 3039 GuestSessionFsSourceSpec source; 3045 3040 source.strSource = aSource; -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r83335 r83336 247 247 * Creates a directory on the guest. 248 248 * 249 * @return VBox status code. VERR_ALREADY_EXISTS if directory on the guest already exists. 249 * @return VBox status code. 250 * VINF_ALREADY_EXISTS if directory on the guest already exists (\a fCanExist is \c true). 251 * VWRN_ALREADY_EXISTS if directory on the guest already exists but must not exist (\a fCanExist is \c false). 250 252 * @param strPath Absolute path to directory on the guest (guest style path) to create. 251 253 * @param enmDirectoryCreateFlags Directory creation flags. … … 270 272 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 271 273 Utf8StrFmt(GuestSession::tr("Guest directory \"%s\" already exists"), strPath.c_str())); 272 return VERR_ALREADY_EXISTS; 273 } 274 rc = VERR_ALREADY_EXISTS; 275 } 276 else 277 rc = VWRN_ALREADY_EXISTS; 274 278 } 275 279 else … … 282 286 { 283 287 case VERR_FILE_NOT_FOUND: 288 RT_FALL_THROUGH(); 284 289 case VERR_PATH_NOT_FOUND: 285 290 rc = mSession->i_directoryCreate(strPath.c_str(), fMode, enmDirectoryCreateFlags, &rcGuest); … … 288 293 break; 289 294 } 295 296 if (RT_FAILURE(rc)) 297 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 298 Utf8StrFmt(GuestSession::tr("Guest error creating directory \"%s\" on the guest: %Rrc"), 299 strPath.c_str(), rcGuest)); 290 300 break; 291 301 } 292 302 293 303 default: 304 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 305 Utf8StrFmt(GuestSession::tr("Host error creating directory \"%s\" on the guest: %Rrc"), 306 strPath.c_str(), rc)); 294 307 break; 295 308 } 296 }297 298 if (RT_FAILURE(rc))299 {300 if (rc == VERR_GSTCTL_GUEST_ERROR)301 {302 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest));303 }304 else305 setProgressErrorMsg(VBOX_E_IPRT_ERROR,306 Utf8StrFmt(GuestSession::tr("Error creating directory on the guest: %Rrc"), strPath.c_str(), rc));307 309 } 308 310 … … 779 781 * 780 782 * @return VBox status code. VINF_NO_CHANGE if file was skipped. 781 * @param strS ourceFull path of source file on the host to copy.782 * @param strD estFull destination path and file name (guest style) to copy file to.783 * @param strSrc Full path of source file on the host to copy. 784 * @param strDst Full destination path and file name (guest style) to copy file to. 783 785 * @param fFileCopyFlags File copy flags. 784 786 */ 785 int GuestSessionTask::fileCopyToGuest(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T fFileCopyFlags) 786 { 787 LogFlowThisFunc(("strSource=%s, strDest=%s, fFileCopyFlags=0x%x\n", strSource.c_str(), strDest.c_str(), fFileCopyFlags)); 788 789 Utf8Str strDestFinal = strDest; 790 791 /** @todo r=bird: Why do we need to do this here? It's a waste of time (extra 792 * IPC) for 99% of the calls, it only does something useful if the 793 * destination is a directory, and you should be able to handle that just 794 * as efficiently in the i_fileOpen() failure path. */ 795 GuestFsObjData dstObjData; 796 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 797 int rc = mSession->i_fsQueryInfo(strDest, TRUE /* fFollowSymlinks */, dstObjData, &rcGuest); 798 if (rc == VERR_GSTCTL_GUEST_ERROR && rcGuest == VERR_FILE_NOT_FOUND) /* File might not exist on the guest yet. */ 799 rc = VINF_SUCCESS; 800 else if (RT_FAILURE(rc)) 801 { 802 setProgressErrorMsg(VBOX_E_IPRT_ERROR, rc == VERR_GSTCTL_GUEST_ERROR ? rcGuest : rc, 803 GuestSession::tr("Destination file lookup for \"%s\" failed: %Rrc"), 804 strDest.c_str(), rc == VERR_GSTCTL_GUEST_ERROR ? rcGuest : rc); 805 return rc; 806 } 807 else 808 { 809 switch (dstObjData.mType) 810 { 811 case FsObjType_Directory: 812 { 813 /* Build the final file name with destination path (on the host). */ 814 char szDstPath[RTPATH_MAX]; 815 /** @todo r=bird: WTF IS THIS SUPPOSED TO BE?!? Use RTStrCopy, memcpy, or similar! 816 * Ever thought about modifying strDestFinal (it's 'Dst' not 'Dest' btw.) 817 * directly? There are any number of append and insert methods in the 818 * RTCString/Utf8Str class for doing that! */ 819 RTStrPrintf2(szDstPath, sizeof(szDstPath), "%s", strDest.c_str()); 820 821 /** @todo r=bird: You're totally ignoring the guest slash-style here! Callers 822 * should have this info. */ 823 /** @todo r=bird: This is wrong even on windows if strDest is 'C:' and the 824 * current working directory (CWD) isn't the root of the drive. :-) */ 825 if ( !strDest.endsWith("\\") 826 && !strDest.endsWith("/")) 827 RTStrCat(szDstPath, sizeof(szDstPath), "/"); 828 829 RTStrCat(szDstPath, sizeof(szDstPath), RTPathFilename(strSource.c_str())); 830 831 strDestFinal = szDstPath; 832 break; 833 } 834 835 case FsObjType_File: 836 if (fFileCopyFlags & FileCopyFlag_NoReplace) 837 { 838 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 839 Utf8StrFmt(GuestSession::tr("Destination file \"%s\" already exists"), 840 strDest.c_str(), rc)); 841 rc = VERR_ALREADY_EXISTS; 842 } 843 break; 844 845 /** @todo r=brent,r=bird: you follow symlinks, so this cannot happen at present. 846 * That said, maybe it isn't intentional to always follow symlinks? */ 847 case FsObjType_Symlink: 848 if (!(fFileCopyFlags & FileCopyFlag_FollowLinks)) 849 { 850 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 851 Utf8StrFmt(GuestSession::tr("Destination file \"%s\" is a symbolic link"), 852 strDest.c_str(), rc)); 853 rc = VERR_IS_A_SYMLINK; 854 } 855 break; 856 857 default: 858 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 859 Utf8StrFmt(GuestSession::tr("Destination element \"%s\" not supported"), strDest.c_str())); 860 rc = VERR_NOT_SUPPORTED; 861 break; 862 } 863 } 864 865 if (RT_FAILURE(rc)) 866 return rc; 787 int GuestSessionTask::fileCopyToGuest(const Utf8Str &strSrc, const Utf8Str &strDst, FileCopyFlag_T fFileCopyFlags) 788 { 789 LogFlowThisFunc(("strSource=%s, strDst=%s, fFileCopyFlags=0x%x\n", strSrc.c_str(), strDst.c_str(), fFileCopyFlags)); 790 791 Utf8Str strDstFinal = strDst; 867 792 868 793 GuestFileOpenInfo dstOpenInfo; 869 dstOpenInfo.mFilename = strD estFinal;794 dstOpenInfo.mFilename = strDstFinal; 870 795 if (fFileCopyFlags & FileCopyFlag_NoReplace) 871 796 dstOpenInfo.mOpenAction = FileOpenAction_CreateNew; … … 876 801 877 802 ComObjPtr<GuestFile> dstFile; 878 rc = mSession->i_fileOpen(dstOpenInfo, dstFile, &rcGuest); 803 int rcGuest; 804 int rc = mSession->i_fileOpen(dstOpenInfo, dstFile, &rcGuest); 879 805 if (RT_FAILURE(rc)) 880 806 { 881 807 setProgressErrorMsg(VBOX_E_IPRT_ERROR, rc == VERR_GSTCTL_GUEST_ERROR ? rcGuest : rc, 882 808 GuestSession::tr("Destination file \"%s\" could not be opened: %Rrc"), 883 strD estFinal.c_str(), rc == VERR_GSTCTL_GUEST_ERROR ? rcGuest : rc);809 strDstFinal.c_str(), rc == VERR_GSTCTL_GUEST_ERROR ? rcGuest : rc); 884 810 return rc; 885 811 } … … 894 820 if (RT_SUCCESS(rc)) 895 821 { 896 rc = RTPathReal(strS ource.c_str(), szSrcReal, sizeof(szSrcReal));822 rc = RTPathReal(strSrc.c_str(), szSrcReal, sizeof(szSrcReal)); 897 823 if (RT_FAILURE(rc)) 898 824 { 899 825 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 900 826 Utf8StrFmt(GuestSession::tr("Source path lookup for \"%s\" failed: %Rrc"), 901 strS ource.c_str(), rc));827 strSrc.c_str(), rc)); 902 828 } 903 829 else … … 908 834 if (fFileCopyFlags & FileCopyFlag_Update) 909 835 { 910 RTTIMESPEC dstModificationTimeTS;911 RTTimeSpecSetSeconds(&dstModificationTimeTS, dstObjData.mModificationTime);912 if (RT TimeSpecCompare(&dstModificationTimeTS, &srcObjInfo.ModificationTime) <= 0)836 GuestFsObjData dstObjData; 837 rc = mSession->i_fileQueryInfo(strDstFinal, fFileCopyFlags & FileCopyFlag_FollowLinks, dstObjData, &rcGuest); 838 if (RT_SUCCESS(rc)) 913 839 { 914 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 915 Utf8StrFmt(GuestSession::tr("Destination file \"%s\" has same or newer modification date"), 916 strDestFinal.c_str())); 917 fSkip = true; 840 RTTIMESPEC dstModificationTimeTS; 841 RTTimeSpecSetSeconds(&dstModificationTimeTS, dstObjData.mModificationTime); 842 if (RTTimeSpecCompare(&dstModificationTimeTS, &srcObjInfo.ModificationTime) <= 0) 843 { 844 LogRel2(("Guest Control: Destination file \"%s\" has same or newer modification date, skipping", 845 strDstFinal.c_str())); 846 fSkip = true; 847 } 848 } 849 else 850 { 851 if (rc == VERR_GSTCTL_GUEST_ERROR) 852 { 853 switch (rcGuest) 854 { 855 case VERR_FILE_NOT_FOUND: 856 rc = VINF_SUCCESS; 857 break; 858 859 default: 860 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 861 Utf8StrFmt(GuestSession::tr("Guest error while determining object data for guest file \"%s\": %Rrc"), 862 strDstFinal.c_str(), rcGuest)); 863 break; 864 } 865 } 866 else 867 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 868 Utf8StrFmt(GuestSession::tr("Host error while determining object data for guest file \"%s\": %Rrc"), 869 strDstFinal.c_str(), rc)); 918 870 } 919 871 } … … 942 894 { 943 895 LogFlowThisFunc(("Copying '%s' to '%s' (%RI64 bytes) ...\n", 944 szSrcReal, strD estFinal.c_str(), srcObjInfo.cbObject));896 szSrcReal, strDstFinal.c_str(), srcObjInfo.cbObject)); 945 897 946 898 rc = fileCopyToGuestInner(hSrcFile, dstFile, fFileCopyFlags, 0 /* Offset, unused */, srcObjInfo.cbObject); … … 1050 1002 if (mSourceSpec.enmType == FsObjType_Directory) 1051 1003 { 1004 LogFlowFunc(("Directory: mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x, fFollowSymlinks=%RTbool, fRecursive=%RTbool\n", 1005 mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.Dir.fCopyFlags, 1006 mSourceSpec.Type.Dir.fFollowSymlinks, mSourceSpec.Type.Dir.fRecursive)); 1007 1052 1008 if ( !mSrcRootAbs.endsWith("/") 1053 1009 && !mSrcRootAbs.endsWith("\\")) … … 1058 1014 mDstRootAbs += "/"; 1059 1015 } 1016 else if (mSourceSpec.enmType == FsObjType_File) 1017 { 1018 LogFlowFunc(("File: mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x\n", 1019 mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.File.fCopyFlags)); 1020 } 1021 else 1022 AssertFailedReturn(VERR_NOT_IMPLEMENTED); 1060 1023 1061 1024 return VINF_SUCCESS; … … 1458 1421 && !strSrc.endsWith("\\")) 1459 1422 { 1460 /** @todo r=bird: All hosts aren't windows either, use RTPATH_IS_SLASH() here! */ 1461 if ( !strDst.endsWith("/") 1462 && !strDst.endsWith("\\")) 1423 if (!RTPATH_IS_SLASH(strDst[strDst.length() - 1])) 1463 1424 strDst += "/"; 1464 1425 1465 /** @todo r=bird: Very unnecessary to use Utf8StrFmt(%s) here when Utf8Str() 1466 * would do perfectly. Also missing try catch. */ 1467 strDst += Utf8StrFmt("%s", RTPathFilenameEx(strSrc.c_str(), mfPathStyle)); 1426 strDst += Utf8Str(RTPathFilenameEx(strSrc.c_str(), mfPathStyle)); 1468 1427 } 1469 1428 … … 1700 1659 Utf8Str strDst = mDest; 1701 1660 1702 if (itSrc->enmType == FsObjType_Directory) 1703 { 1704 /* If the source does not end with a slash, copy over the entire directory 1705 * (and not just its contents). */ 1706 if ( !strSrc.endsWith("/") 1707 && !strSrc.endsWith("\\")) 1708 { 1709 if ( !strDst.endsWith("/") 1710 && !strDst.endsWith("\\")) 1711 strDst += "/"; 1712 1713 strDst += Utf8StrFmt("%s", RTPathFilenameEx(strSrc.c_str(), mfPathStyle)); 1714 } 1715 } 1716 1717 LogFlowFunc(("strSrc=%s, strDst=%s\n", strSrc.c_str(), strDst.c_str())); 1661 LogFlowFunc(("Source: strSrc=%s, strDst=%s\n", strSrc.c_str(), strDst.c_str())); 1718 1662 1719 1663 RTFSOBJINFO srcFsObjInfo; … … 1818 1762 AssertPtr(pList); 1819 1763 1764 Utf8Str strSrcRootAbs = pList->mSrcRootAbs; 1765 Utf8Str strDstRootAbs = pList->mDstRootAbs; 1766 1820 1767 bool fCopyIntoExisting = false; 1821 1768 bool fFollowSymlinks = false; 1822 1769 uint32_t fDirMode = 0700; /** @todo Play safe by default; implement ACLs. */ 1823 1770 1824 LogFlowFunc(("List: srcRootAbs=%s, dstRootAbs=%s\n", pList->mSrcRootAbs.c_str(), pList->mDstRootAbs.c_str())); 1771 GuestFsObjData dstObjData; 1772 int rcGuest; 1773 rc = mSession->i_fsQueryInfo(strDstRootAbs, pList->mSourceSpec.Type.Dir.fFollowSymlinks, dstObjData, &rcGuest); 1774 if (RT_FAILURE(rc)) 1775 { 1776 if (rc == VERR_GSTCTL_GUEST_ERROR) 1777 { 1778 switch (rcGuest) 1779 { 1780 case VERR_PATH_NOT_FOUND: 1781 RT_FALL_THROUGH(); 1782 case VERR_FILE_NOT_FOUND: 1783 /* We will deal with this down below. */ 1784 rc = VINF_SUCCESS; 1785 break; 1786 default: 1787 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1788 Utf8StrFmt(GuestSession::tr("Querying information on for '%s' failed: %Rrc"), 1789 strDstRootAbs.c_str(), rcGuest)); 1790 break; 1791 } 1792 } 1793 else 1794 { 1795 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1796 Utf8StrFmt(GuestSession::tr("Querying information on guest for '%s' failed: %Rrc"), 1797 strDstRootAbs.c_str(), rc)); 1798 break; 1799 } 1800 } 1801 1802 LogFlowFunc(("List inital: rc=%Rrc, srcRootAbs=%s, dstRootAbs=%s\n", 1803 rc, strSrcRootAbs.c_str(), strDstRootAbs.c_str())); 1804 1805 /* Calculated file copy flags for the current source spec. */ 1806 FileCopyFlag_T fFileCopyFlags = FileCopyFlag_None; 1825 1807 1826 1808 /* Create the root directory. */ … … 1830 1812 fFollowSymlinks = pList->mSourceSpec.Type.Dir.fFollowSymlinks; 1831 1813 1832 if (pList->mSourceSpec.fDryRun == false) 1833 { 1834 rc = directoryCreateOnGuest(pList->mDstRootAbs, DirectoryCreateFlag_None, fDirMode, 1835 fFollowSymlinks, fCopyIntoExisting); 1836 if (RT_FAILURE(rc)) 1837 break; 1838 } 1814 LogFlowFunc(("Directory: fDirCopyFlags=%#x, fCopyIntoExisting=%RTbool, fFollowSymlinks=%RTbool\n", 1815 pList->mSourceSpec.Type.Dir.fCopyFlags, fCopyIntoExisting, fFollowSymlinks)); 1816 1817 /* If the directory on the guest already exists, append the name of the root source directory to it. */ 1818 if (dstObjData.mType == FsObjType_Directory) 1819 { 1820 if (fCopyIntoExisting) 1821 { 1822 if ( !strDstRootAbs.endsWith("/") 1823 && !strDstRootAbs.endsWith("\\")) 1824 strDstRootAbs += "/"; 1825 strDstRootAbs += Utf8Str(RTPathFilenameEx(strSrcRootAbs.c_str(), mfPathStyle)); 1826 } 1827 else 1828 { 1829 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1830 Utf8StrFmt(GuestSession::tr("Guest directory \"%s\" already exists"), 1831 strDstRootAbs.c_str())); 1832 rc = VERR_ALREADY_EXISTS; 1833 } 1834 } 1835 1836 /* Make sure the destination root directory exists. */ 1837 if ( RT_SUCCESS(rc) 1838 && pList->mSourceSpec.fDryRun == false) 1839 { 1840 rc = directoryCreateOnGuest(strDstRootAbs, DirectoryCreateFlag_None, fDirMode, 1841 fFollowSymlinks, true /* fCanExist */); 1842 } 1843 1844 /* No tweaking of fFileCopyFlags needed here. */ 1839 1845 } 1840 1846 else if (pList->mSourceSpec.enmType == FsObjType_File) … … 1842 1848 fCopyIntoExisting = !(pList->mSourceSpec.Type.File.fCopyFlags & FileCopyFlag_NoReplace); 1843 1849 fFollowSymlinks = RT_BOOL(pList->mSourceSpec.Type.File.fCopyFlags & FileCopyFlag_FollowLinks); 1850 1851 LogFlowFunc(("File: fFileCopyFlags=%#x, fCopyIntoExisting=%RTbool, fFollowSymlinks=%RTbool\n", 1852 pList->mSourceSpec.Type.File.fCopyFlags, fCopyIntoExisting, fFollowSymlinks)); 1853 1854 fFileCopyFlags = pList->mSourceSpec.Type.File.fCopyFlags; /* Just use the flags directly from the spec. */ 1844 1855 } 1845 1856 else 1846 AssertFailed(); 1857 AssertFailedStmt(rc = VERR_NOT_SUPPORTED); 1858 1859 if (RT_FAILURE(rc)) 1860 break; 1861 1862 LogFlowFunc(("List final: rc=%Rrc, srcRootAbs=%s, dstRootAbs=%s, fFileCopyFlags=%#x\n", 1863 rc, strSrcRootAbs.c_str(), strDstRootAbs.c_str(), fFileCopyFlags)); 1864 1865 LogRel2(("Guest Control: Copying '%s' from host to '%s' on guest ...\n", strSrcRootAbs.c_str(), strDstRootAbs.c_str())); 1847 1866 1848 1867 FsEntries::const_iterator itEntry = pList->mVecEntries.begin(); 1849 while (itEntry != pList->mVecEntries.end()) 1868 while ( RT_SUCCESS(rc) 1869 && itEntry != pList->mVecEntries.end()) 1850 1870 { 1851 1871 FsEntry *pEntry = *itEntry; 1852 1872 AssertPtr(pEntry); 1853 1873 1854 Utf8Str strSrcAbs = pList->mSrcRootAbs; 1855 Utf8Str strDstAbs = pList->mDstRootAbs; 1874 Utf8Str strSrcAbs = strSrcRootAbs; 1875 Utf8Str strDstAbs = strDstRootAbs; 1876 1856 1877 if (pList->mSourceSpec.enmType == FsObjType_Directory) 1857 1878 { 1879 if ( !strSrcAbs.endsWith("/") 1880 && !strSrcAbs.endsWith("\\")) 1881 strSrcAbs += "/"; 1858 1882 strSrcAbs += pEntry->strPath; 1883 } 1884 1885 /** @todo Handle stuff like "C:" for destination, where the destination will be the CWD for drive C. */ 1886 if (dstObjData.mType == FsObjType_Directory) 1887 { 1888 if ( !strDstAbs.endsWith("/") 1889 && !strDstAbs.endsWith("\\")) 1890 strDstAbs += "/"; 1859 1891 strDstAbs += pEntry->strPath; 1860 1892 } … … 1862 1894 mProgress->SetNextOperation(Bstr(strSrcAbs).raw(), 1); 1863 1895 1896 LogFlowFunc(("strEntry='%s'\n", pEntry->strPath.c_str())); 1897 LogFlowFunc(("\tsrcAbs='%s'\n", strSrcAbs.c_str())); 1898 LogFlowFunc(("\tdstAbs='%s'\n", strDstAbs.c_str())); 1899 1864 1900 switch (pEntry->fMode & RTFS_TYPE_MASK) 1865 1901 { 1866 1902 case RTFS_TYPE_DIRECTORY: 1867 LogFlowFunc(("Directory '%s': %s -> %s\n", pEntry->strPath.c_str(), strSrcAbs.c_str(), strDstAbs.c_str()));1903 { 1868 1904 if (!pList->mSourceSpec.fDryRun) 1869 {1870 1905 rc = directoryCreateOnGuest(strDstAbs, DirectoryCreateFlag_None, fDirMode, 1871 1906 fFollowSymlinks, fCopyIntoExisting); 1872 if (RT_FAILURE(rc))1873 break;1874 }1875 1907 break; 1908 } 1876 1909 1877 1910 case RTFS_TYPE_FILE: 1878 LogFlowFunc(("File '%s': %s -> %s\n", pEntry->strPath.c_str(), strSrcAbs.c_str(), strDstAbs.c_str()));1911 { 1879 1912 if (!pList->mSourceSpec.fDryRun) 1880 rc = fileCopyToGuest(strSrcAbs, strDstAbs, pList->mSourceSpec.Type.File.fCopyFlags);1913 rc = fileCopyToGuest(strSrcAbs, strDstAbs, fFileCopyFlags); 1881 1914 break; 1915 } 1882 1916 1883 1917 default: 1884 Log FlowFunc(("Warning: Type %d for '%s' is not supported\n",1885 1918 LogRel2(("Guest Control: Warning: Type 0x%x for '%s' is not supported, skipping\n", 1919 pEntry->fMode & RTFS_TYPE_MASK, strSrcAbs.c_str())); 1886 1920 break; 1887 1921 }
Note:
See TracChangeset
for help on using the changeset viewer.