- Timestamp:
- Oct 26, 2010 11:18:04 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67049
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r33451 r33458 244 244 osTypeId.raw(), 245 245 Guid(id).toUtf16().raw(), 246 FALSE /* forceOverwrite */, 246 247 machine.asOutParam())); 247 248 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp
r33451 r33458 647 647 field("name").toString(), 648 648 typeId, 649 QString::null); // machine ID 649 QString::null, // machine ID 650 false); // forceOverwrite 650 651 if (!vbox.isOk()) 651 652 { … … 659 660 m_Machine.SetExtraData(VBoxDefs::GUI_FirstRun, "yes"); 660 661 } 661 662 662 663 663 /* RAM size */ -
trunk/src/VBox/Main/ApplianceImplImport.cpp
r33451 r33458 1820 1820 Bstr(stack.strOsTypeVBox).raw(), 1821 1821 NULL, /* uuid */ 1822 FALSE, /* fForceOverwrite */ 1822 1823 pNewMachine.asOutParam()); 1823 1824 if (FAILED(rc)) throw rc; -
trunk/src/VBox/Main/MachineImpl.cpp
r33451 r33458 253 253 * @param strName name for the machine 254 254 * @param aId UUID for the new machine. 255 * @param aOsType Optional OS Type of this machine. 255 * @param aOsType OS Type of this machine or NULL. 256 * @param fForceOverwrite Whether to overwrite an existing machine settings file. 256 257 * 257 258 * @return Success indicator. if not S_OK, the machine object is invalid … … 260 261 const Utf8Str &strConfigFile, 261 262 const Utf8Str &strName, 263 GuestOSType *aOsType, 262 264 const Guid &aId, 263 GuestOSType *aOsType /* = NULL */)265 bool fForceOverwrite) 264 266 { 265 267 LogFlowThisFuncEnter(); … … 273 275 if (FAILED(rc)) return rc; 274 276 275 rc = tryCreateMachineConfigFile( );277 rc = tryCreateMachineConfigFile(fForceOverwrite); 276 278 if (FAILED(rc)) return rc; 277 279 … … 473 475 if (FAILED(rc)) return rc; 474 476 475 rc = tryCreateMachineConfigFile( );477 rc = tryCreateMachineConfigFile(false /* fForceOverwrite */); 476 478 if (FAILED(rc)) return rc; 477 479 … … 569 571 * @return 570 572 */ 571 HRESULT Machine::tryCreateMachineConfigFile( )573 HRESULT Machine::tryCreateMachineConfigFile(bool fForceOverwrite) 572 574 { 573 575 HRESULT rc = S_OK; … … 582 584 if (RT_SUCCESS(vrc)) 583 585 RTFileClose(f); 584 rc = setError(VBOX_E_FILE_ERROR, 585 tr("Machine settings file '%s' already exists"), 586 mData->m_strConfigFileFull.c_str()); 586 if (!fForceOverwrite) 587 rc = setError(VBOX_E_FILE_ERROR, 588 tr("Machine settings file '%s' already exists"), 589 mData->m_strConfigFileFull.c_str()); 590 else 591 { 592 /* try to delete the config file, as otherwise the creation 593 * of a new settings file will fail. */ 594 int vrc2 = RTFileDelete(mData->m_strConfigFileFull.c_str()); 595 if (RT_FAILURE(vrc2)) 596 rc = setError(VBOX_E_FILE_ERROR, 597 tr("Could not delete the existing settings file '%s' (%Rrc)"), 598 mData->m_strConfigFileFull.c_str(), vrc2); 599 } 587 600 } 588 601 else if ( vrc != VERR_FILE_NOT_FOUND -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r33451 r33458 1198 1198 IN_BSTR aOsTypeId, 1199 1199 IN_BSTR aId, 1200 BOOL forceOverwrite, 1200 1201 IMachine **aMachine) 1201 1202 { … … 1239 1240 Utf8Str(bstrSettingsFile), 1240 1241 Utf8Str(aName), 1242 osType, 1241 1243 id, 1242 osType);1244 !!forceOverwrite); 1243 1245 if (SUCCEEDED(rc)) 1244 1246 { -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r33452 r33458 1374 1374 <interface 1375 1375 name="IVirtualBox" extends="$unknown" 1376 uuid=" 4bbb7840-f46a-4672-90e2-c4bf65c3c74c"1376 uuid="6e123115-af60-49b3-9727-d3f302306cd2" 1377 1377 wsmap="managed" 1378 1378 > … … 1657 1657 <param name="id" type="uuid" mod="string" dir="in"> 1658 1658 <desc>Machine UUID (optional).</desc> 1659 </param> 1660 <param name="forceOverwrite" type="boolean" dir="in"> 1661 <desc>If true, an existing machine settings file will be overwritten.</desc> 1659 1662 </param> 1660 1663 <param name="machine" type="IMachine" dir="return"> -
trunk/src/VBox/Main/include/MachineImpl.h
r33451 r33458 332 332 const Utf8Str &strConfigFile, 333 333 const Utf8Str &strName, 334 GuestOSType *aOsType, 334 335 const Guid &aId, 335 GuestOSType *aOsType = NULL);336 bool fForceOverwrite); 336 337 337 338 // initializer for loading existing machine XML (either registered or not) … … 357 358 HRESULT initDataAndChildObjects(); 358 359 HRESULT registeredInit(); 359 HRESULT tryCreateMachineConfigFile( );360 HRESULT tryCreateMachineConfigFile(bool fForceOverwrite); 360 361 void uninitDataAndChildObjects(); 361 362 -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r33451 r33458 127 127 IN_BSTR aOsTypeId, 128 128 IN_BSTR aId, 129 BOOL forceOverwrite, 129 130 IMachine **aMachine); 130 131 STDMETHOD(OpenMachine) (IN_BSTR aSettingsFile, IMachine **aMachine); -
trunk/src/VBox/Main/testcase/tstVBoxAPILinux.cpp
r33451 r33458 190 190 */ 191 191 nsCOMPtr<IMachine> machine; 192 rc = virtualBox->CreateMachine(NULL, 192 rc = virtualBox->CreateMachine(NULL, /* settings file */ 193 193 NS_LITERAL_STRING("A brand new name").get(), 194 nsnull, 195 false, 194 nsnull, /* ostype */ 195 nsnull, /* machine uuid */ 196 false, /* forceOverwrite */ 196 197 getter_AddRefs(machine)); 197 198 if (NS_FAILED(rc))
Note:
See TracChangeset
for help on using the changeset viewer.