- Timestamp:
- Mar 28, 2018 9:35:16 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121510
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r71510 r71533 1390 1390 } 1391 1391 1392 const char *psz FileName = mSource.c_str();1393 1394 if ( !psz FileName1395 || !RTFileExists(psz FileName))1392 const char *pszSrcFile = mSource.c_str(); 1393 1394 if ( !pszSrcFile 1395 || !RTFileExists(pszSrcFile)) 1396 1396 { 1397 1397 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1398 Utf8StrFmt(GuestSession::tr("Source file \"%s\" not valid or does not exist"), psz FileName));1398 Utf8StrFmt(GuestSession::tr("Source file \"%s\" not valid or does not exist"), pszSrcFile)); 1399 1399 return VERR_FILE_NOT_FOUND; 1400 1400 } … … 1408 1408 } 1409 1409 1410 /** @todo Try to lock the destination directory on the guest here first? */ 1410 /** @todo Try to lock the destination file / directory on the guest here first? */ 1411 char *pszDstFile = NULL; 1411 1412 1412 1413 int rc = VINF_SUCCESS; … … 1426 1427 { 1427 1428 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1428 Utf8StrFmt(GuestSession::tr("Path \"%s\" is not a directory on guest"), mDest.c_str()));1429 Utf8StrFmt(GuestSession::tr("Path \"%s\" is not a directory on guest"), pszDstFile)); 1429 1430 rc = VERR_NOT_A_DIRECTORY; 1430 1431 } 1431 1432 else 1432 1433 { 1433 AssertPtr(pszFileName); 1434 mDest += pszFileName; 1434 /* Build the final file name with destination path (on the guest). */ 1435 char szDstPath[RTPATH_MAX]; 1436 RTStrPrintf2(szDstPath, sizeof(szDstPath), "%s", mDest.c_str()); 1437 1438 RTPathAppend(szDstPath, sizeof(szDstPath), RTPathFilename(pszSrcFile)); 1439 1440 pszDstFile = RTStrDup(szDstPath); 1435 1441 } 1436 1442 } … … 1447 1453 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1448 1454 Utf8StrFmt(GuestSession::tr("Unable to query information for directory \"%s\" on the guest: %Rrc"), 1449 mDest.c_str(), rc));1455 pszDstFile, rc)); 1450 1456 break; 1451 1457 } 1452 1458 } 1453 1459 } 1460 else 1461 pszDstFile = RTStrDup(mDest.c_str()); 1454 1462 1455 1463 if (RT_SUCCESS(rc)) 1456 1464 { 1465 AssertPtrReturn(pszDstFile, VERR_NO_MEMORY); 1466 1457 1467 if (mSourceFile) /* Use existing file handle. */ 1458 rc = fileCopyToEx( mSource, mDest, (FileCopyFlag_T)mFileCopyFlags, mSourceFile, mSourceOffset, mSourceSize);1468 rc = fileCopyToEx(pszSrcFile, pszDstFile, (FileCopyFlag_T)mFileCopyFlags, mSourceFile, mSourceOffset, mSourceSize); 1459 1469 else 1460 rc = fileCopyTo( mSource, mDest, (FileCopyFlag_T)mFileCopyFlags);1470 rc = fileCopyTo(pszSrcFile, pszDstFile, (FileCopyFlag_T)mFileCopyFlags); 1461 1471 1462 1472 if (RT_SUCCESS(rc)) 1463 1473 rc = setProgressSuccess(); 1464 1474 } 1475 1476 if (pszDstFile) 1477 RTStrFree(pszDstFile); 1465 1478 1466 1479 LogFlowFuncLeaveRC(rc);
Note:
See TracChangeset
for help on using the changeset viewer.