Changeset 91131 in vbox for trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
- Timestamp:
- Sep 6, 2021 7:02:28 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r90828 r91131 317 317 HRESULT rc; 318 318 const char *pszSrcName = NULL; 319 const char *pszTargetFolder = NULL;320 319 const char *pszType = NULL; 320 char szTargetFolder[RTPATH_MAX]; 321 321 322 322 int c; … … 337 337 338 338 case 'f': // --target folder 339 340 char szPath[RTPATH_MAX]; 341 pszTargetFolder = ValueUnion.psz; 342 343 vrc = RTPathAbs(pszTargetFolder, szPath, sizeof(szPath)); 344 if (RT_FAILURE(vrc)) 345 return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTPathAbs(%s,,) failed with rc=%Rrc", pszTargetFolder, vrc); 339 if (ValueUnion.psz && ValueUnion.psz[0] != '\0') 340 { 341 vrc = RTPathAbs(ValueUnion.psz, szTargetFolder, sizeof(szTargetFolder)); 342 if (RT_FAILURE(vrc)) 343 return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTPathAbs(%s,,) failed with rc=%Rrc", ValueUnion.psz, vrc); 344 } else { 345 szTargetFolder[0] = '\0'; 346 } 346 347 break; 347 348 … … 384 385 385 386 CHECK_ERROR_RET(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()), RTEXITCODE_FAILURE); 386 CHECK_ERROR_RET(sessionMachine, MoveTo(Bstr(pszTargetFolder).raw(), 387 CHECK_ERROR_RET(sessionMachine, 388 MoveTo(Bstr(szTargetFolder).raw(), 387 389 Bstr(pszType).raw(), 388 progress.asOutParam()), RTEXITCODE_FAILURE); 390 progress.asOutParam()), 391 RTEXITCODE_FAILURE); 389 392 rc = showProgress(progress); 390 393 CHECK_PROGRESS_ERROR_RET(progress, ("Move VM failed"), RTEXITCODE_FAILURE); … … 393 396 CHECK_ERROR_RET(a->session, UnlockMachine(), RTEXITCODE_FAILURE); 394 397 395 // do 396 // { 397 // /* we have to open a session for this task */ 398 // CHECK_ERROR_BREAK(srcMachine, LockMachine(a->session, LockType_Write)); 399 // ComPtr<IMachine> sessionMachine; 400 // do 401 // { 402 // CHECK_ERROR_BREAK(a->session, COMGETTER(Machine)(sessionMachine.asOutParam())); 403 // CHECK_ERROR_BREAK(sessionMachine, MoveTo(Bstr(pszTargetFolder).raw(), 404 // Bstr(pszType).raw(), 405 // progress.asOutParam())); 406 // rc = showProgress(progress); 407 // CHECK_PROGRESS_ERROR_RET(progress, ("Move VM failed"), RTEXITCODE_FAILURE); 408 //// CHECK_ERROR_BREAK(sessionMachine, SaveSettings()); 409 // } while (0); 410 // 411 // sessionMachine.setNull(); 412 // CHECK_ERROR_BREAK(a->session, UnlockMachine()); 413 // } while (0); 414 RTPrintf("Machine has been successfully moved into %s\n", pszTargetFolder); 398 RTPrintf("Machine has been successfully moved into %s\n", szTargetFolder[0] != '\0' ? szTargetFolder : "the same location"); 415 399 } 416 400
Note:
See TracChangeset
for help on using the changeset viewer.