Changeset 97485 in vbox for trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
- Timestamp:
- Nov 9, 2022 6:01:39 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 154499
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r97481 r97485 1460 1460 */ 1461 1461 1462 if (mDest.isEmpty()) 1462 if (mSources.empty()) 1463 { 1464 strErrorInfo.printf(tr("No guest sources specified")); 1465 vrc = VERR_INVALID_PARAMETER; 1466 } 1467 else if (mDest.isEmpty()) 1463 1468 { 1464 1469 strErrorInfo.printf(tr("Host destination must not be empty")); … … 1578 1583 } 1579 1584 1580 if ( cOperations) /* Use the first element as description (if available). */1581 { 1582 Assert(mVecLists.size());1583 Assert(mVecLists[0]->mVecEntries.size());1584 1585 Utf8Str const &strFirstOp = mVecLists[0]->mVecEntries[0]->strPath;1585 if (RT_SUCCESS(vrc)) 1586 { 1587 /* When there are no entries in the first source list, this means the source only contains a single file 1588 * (see \a mSrcRootAbs of FsList). So use \a mSrcRootAbs directly. */ 1589 Utf8Str const &strFirstOp = mVecLists[0]->mVecEntries.size() > 0 1590 ? mVecLists[0]->mVecEntries[0]->strPath : mVecLists[0]->mSrcRootAbs; 1586 1591 1587 1592 /* Now that we know how many objects we're handling, tweak the progress description so that it … … 1598 1603 TRUE /* aCancelable */, cOperations + 1 /* Number of operations */, Bstr(strFirstOp).raw()); 1599 1604 } 1600 else /* If no operations have been defined,go with an "empty" progress object when will be used for error handling. */1605 else /* On error we go with an "empty" progress object when will be used for error handling. */ 1601 1606 hrc = pProgress->init(static_cast<IGuestSession*>(mSession), Bstr(mDesc).raw(), 1602 1607 TRUE /* aCancelable */, 1 /* cOperations */, Bstr(mDesc).raw()); 1603 1608 1609 if (FAILED(hrc)) /* Progress object creation failed -- we're doomed. */ 1610 return hrc; 1611 1604 1612 if (RT_FAILURE(vrc)) 1605 1613 { 1606 1614 if (strErrorInfo.isEmpty()) 1607 1615 strErrorInfo.printf(tr("Failed with %Rrc"), vrc); 1608 setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo);1616 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo); 1609 1617 } 1610 1618 … … 1916 1924 */ 1917 1925 1918 if (mDest.isEmpty()) 1926 if (mSources.empty()) 1927 { 1928 strErrorInfo.printf(tr("No host sources specified")); 1929 vrc = VERR_INVALID_PARAMETER; 1930 } 1931 else if (mDest.isEmpty()) 1919 1932 { 1920 1933 strErrorInfo.printf(tr("Guest destination must not be empty")); … … 1993 2006 vrc = pFsList->AddDirFromHost(strSrc /* strPath */, "" /* strSubDir */, 1994 2007 szPathReal, sizeof(szPathReal), &DirEntry); 2008 break; 1995 2009 } 1996 2010 … … 2031 2045 } 2032 2046 2033 if ( cOperations) /* Use the first element as description (if available). */2034 { 2035 Assert(mVecLists.size());2036 Assert(mVecLists[0]->mVecEntries.size());2037 2038 Utf8Str const &strFirstOp = mVecLists[0]->mVecEntries[0]->strPath;2047 if (RT_SUCCESS(vrc)) 2048 { 2049 /* When there are no entries in the first source list, this means the source only contains a single file 2050 * (see \a mSrcRootAbs of FsList). So use \a mSrcRootAbs directly. */ 2051 Utf8Str const &strFirstOp = mVecLists[0]->mVecEntries.size() > 0 2052 ? mVecLists[0]->mVecEntries[0]->strPath : mVecLists[0]->mSrcRootAbs; 2039 2053 2040 2054 /* Now that we know how many objects we're handling, tweak the progress description so that it … … 2049 2063 2050 2064 hrc = pProgress->init(static_cast<IGuestSession*>(mSession), Bstr(mDesc).raw(), 2051 TRUE /* aCancelable */, cOperations + 1 2065 TRUE /* aCancelable */, cOperations + 1/* Number of operations */, 2052 2066 Bstr(strFirstOp).raw()); 2053 2067 } 2054 else /* If no operations have been defined,go with an "empty" progress object when will be used for error handling. */2068 else /* On error we go with an "empty" progress object when will be used for error handling. */ 2055 2069 hrc = pProgress->init(static_cast<IGuestSession*>(mSession), Bstr(mDesc).raw(), 2056 2070 TRUE /* aCancelable */, 1 /* cOperations */, Bstr(mDesc).raw()); 2057 2071 2072 if (FAILED(hrc)) /* Progress object creation failed -- we're doomed. */ 2073 return hrc; 2074 2058 2075 if (RT_FAILURE(vrc)) 2059 2076 { 2060 2077 if (strErrorInfo.isEmpty()) 2061 2078 strErrorInfo.printf(tr("Failed with %Rrc"), vrc); 2062 setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo);2079 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo); 2063 2080 } 2064 2081
Note:
See TracChangeset
for help on using the changeset viewer.