Changeset 82363 in vbox for trunk/src/VBox/Main
- Timestamp:
- Dec 4, 2019 7:30:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r82337 r82363 1439 1439 } 1440 1440 1441 /* Check the target path. If the path exists and folder isn't empty return an error */ 1442 { 1443 Bstr bstrSettingsFilename; 1444 /* Based on the VM name, create a target machine path. */ 1445 hrc = mVirtualBox->ComposeMachineFilename(Bstr(strVMName).raw(), 1446 Bstr("/").raw(), 1447 NULL /* aCreateFlags */, 1448 NULL /* aBaseFolder */, 1449 bstrSettingsFilename.asOutParam()); 1450 if (FAILED(hrc)) 1451 break; 1452 1453 Utf8Str strMachineFolder(bstrSettingsFilename); 1454 strMachineFolder.stripFilename(); 1455 1456 RTFSOBJINFO dirInfo; 1457 vrc = RTPathQueryInfo(strMachineFolder.c_str(), &dirInfo, RTFSOBJATTRADD_NOTHING); 1458 if (RT_SUCCESS(vrc)) 1459 { 1460 size_t counter = 0; 1461 RTDIR hDir; 1462 vrc = RTDirOpen(&hDir, strMachineFolder.c_str()); 1463 if (RT_SUCCESS(vrc)) 1464 { 1465 RTDIRENTRY DirEntry; 1466 while (RT_SUCCESS(RTDirRead(hDir, &DirEntry, NULL))) 1467 { 1468 if (RTDirEntryIsStdDotLink(&DirEntry)) 1469 continue; 1470 ++counter; 1471 } 1472 1473 if ( hDir != NULL) 1474 vrc = RTDirClose(hDir); 1475 } 1476 else 1477 return setErrorVrc(vrc, tr("Can't open folder %s"), strMachineFolder.c_str()); 1478 1479 if (counter > 0) 1480 { 1481 return setErrorVrc(VERR_ALREADY_EXISTS, tr("The target folder %s has already contained some" 1482 " files (%d items). Clear the folder from the files or choose another folder"), 1483 strMachineFolder.c_str(), counter); 1484 } 1485 } 1486 } 1487 1441 1488 Utf8Str strInsId; 1442 1489 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId)//aVBoxValues is set in this #define 1443 1490 if (aVBoxValues.size() == 0) 1444 { 1445 hrc = setErrorVrc(VERR_NOT_FOUND, "%s: Cloud Instance Id wasn't found", __FUNCTION__); 1446 break; 1447 } 1491 return setErrorVrc(VERR_NOT_FOUND, "%s: Cloud Instance Id wasn't found", __FUNCTION__); 1492 1448 1493 strInsId = aVBoxValues[0]; 1449 1494 … … 1492 1537 * future function which will eliminate the temporary objects created during the first phase. 1493 1538 * hrc = cloud.EliminateImportLeavings(aVBoxValues[0], pProgress); */ 1539 /* 1494 1540 if (FAILED(hrc)) 1495 1541 { 1496 hrc = setError Vrc(VERR_INVALID_STATE, tr("Some leavings may exist in the Cloud."));1542 hrc = setError(hrc, tr("Some leavings may exist in the Cloud.")); 1497 1543 LogRel(("%s: Cleanup action - the leavings in the %s after import the " 1498 1544 "instance %s may not have been deleted\n", … … 1503 1549 "instance %s have been deleted\n", 1504 1550 __FUNCTION__, strProviderName.c_str(), vsdData.c_str())); 1551 */ 1505 1552 } 1506 1553 … … 1513 1560 if (FAILED(hrc)) 1514 1561 { 1515 Utf8Str generalRollBackErrorMessage("Rollback action for Import Cloud operation failed. "1562 Utf8Str generalRollBackErrorMessage("Rollback action for Import Cloud operation failed. " 1516 1563 "Some leavings may exist on the local disk or in the Cloud."); 1517 1564 /* … … 1819 1866 /* Write the file on the disk */ 1820 1867 vrc = RTVfsFileOpenNormal(strAbsDstPath.c_str(), 1821 RTFILE_O_WRITE | RTFILE_O_DENY_ALL | RTFILE_O_CREATE _REPLACE,1868 RTFILE_O_WRITE | RTFILE_O_DENY_ALL | RTFILE_O_CREATE, 1822 1869 &hVfsDstFile); 1823 1870 if (RT_FAILURE(vrc))
Note:
See TracChangeset
for help on using the changeset viewer.