Changeset 33904 in vbox
- Timestamp:
- Nov 9, 2010 2:56:28 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 67560
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r33386 r33904 214 214 else 215 215 RTPrintf("Config file: %lS\n", settingsFilePath.raw()); 216 217 Bstr snapshotFolder; 218 rc = machine->COMGETTER(SnapshotFolder)(snapshotFolder.asOutParam()); 219 if (details == VMINFO_MACHINEREADABLE) 220 RTPrintf("SnapFldr=\"%lS\"\n", snapshotFolder.raw()); 221 else 222 RTPrintf("Snapshot folder: %lS\n", snapshotFolder.raw()); 223 224 Bstr logFolder; 225 rc = machine->COMGETTER(LogFolder)(logFolder.asOutParam()); 226 if (details == VMINFO_MACHINEREADABLE) 227 RTPrintf("LogFldr=\"%lS\"\n", logFolder.raw()); 228 else 229 RTPrintf("Log folder: %lS\n", logFolder.raw()); 216 230 217 231 Bstr strHardwareUuid; -
trunk/src/VBox/Main/MachineImpl.cpp
r33848 r33904 293 293 294 294 mUserData->s.strName = strName; 295 mUserData->s.fNameSync = true; 296 297 /* initialize the default snapshots folder 298 * (note: depends on the name value set above!) */ 295 296 // the "name sync" flag determines whether the machine directory gets renamed along 297 // with the machine file; say so if the settings file name is the same as the 298 // settings file parent directory (machine directory) 299 mUserData->s.fNameSync = isInOwnDir(); 300 301 // initialize the default snapshots folder 299 302 rc = COMSETTER(SnapshotFolder)(NULL); 300 303 AssertComRC(rc); … … 2083 2086 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2084 2087 2085 mUserData->m_strSnapshotFolderFull.cloneTo(aSnapshotFolder); 2088 Utf8Str strFullSnapshotFolder; 2089 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 2090 strFullSnapshotFolder.cloneTo(aSnapshotFolder); 2086 2091 2087 2092 return S_OK; … … 2111 2116 2112 2117 Utf8Str strSnapshotFolder0(aSnapshotFolder); // keep original 2118 2113 2119 Utf8Str strSnapshotFolder(strSnapshotFolder0); 2114 2115 2120 if (strSnapshotFolder.isEmpty()) 2116 { 2117 if (isInOwnDir()) 2118 /* the default snapshots folder is 'Snapshots' in the machine dir */ 2119 strSnapshotFolder = "Snapshots"; 2120 else 2121 /* the default snapshots folder is {UUID}, for backwards 2122 * compatibility and to resolve conflicts */ 2123 strSnapshotFolder = Utf8StrFmt("{%RTuuid}", mData->mUuid.raw()); 2124 } 2125 2126 int vrc = calculateFullPath(strSnapshotFolder, strSnapshotFolder); 2121 strSnapshotFolder = "Snapshots"; 2122 int vrc = calculateFullPath(strSnapshotFolder, 2123 strSnapshotFolder); 2127 2124 if (RT_FAILURE(vrc)) 2128 2125 return setError(E_FAIL, … … 2132 2129 setModified(IsModified_MachineData); 2133 2130 mUserData.backup(); 2134 mUserData->s.strSnapshotFolder = strSnapshotFolder0; 2135 mUserData->m_strSnapshotFolderFull = strSnapshotFolder;2131 2132 copyPathRelativeToMachine(strSnapshotFolder, mUserData->s.strSnapshotFolder); 2136 2133 2137 2134 return S_OK; … … 2340 2337 Utf8Str logFolder; 2341 2338 getLogFolder(logFolder); 2342 2343 Bstr (logFolder).cloneTo(aLogFolder); 2339 logFolder.cloneTo(aLogFolder); 2344 2340 2345 2341 return S_OK; … … 3591 3587 } 3592 3588 3589 Utf8Str strFullSnapshotFolder; 3590 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 3591 3593 3592 ComObjPtr<Medium> diff; 3594 3593 diff.createObject(); 3595 3594 rc = diff->init(mParent, 3596 3595 medium->getPreferredDiffFormat(), 3597 Utf8Str(mUserData->m_strSnapshotFolderFull).append(RTPATH_SLASH_STR),3596 strFullSnapshotFolder.append(RTPATH_SLASH_STR), 3598 3597 medium->getFirstRegistryMachineId(), // store this diff in the same registry as the parent 3599 3598 &fNeedsGlobalSaveSettings); … … 4535 4534 * there (we don't check for errors because the user might have 4536 4535 * some private files there that we don't want to delete) */ 4537 Assert(mUserData->m_strSnapshotFolderFull.length()); 4538 if (RTDirExists(mUserData->m_strSnapshotFolderFull.c_str())) 4539 RTDirRemove(mUserData->m_strSnapshotFolderFull.c_str()); 4540 4541 /* delete the directory that contains the settings file, but only 4542 * if it matches the VM name (i.e. a structure created by default in 4543 * prepareSaveSettings()) */ 4544 { 4545 Utf8Str settingsDir; 4546 if (isInOwnDir(&settingsDir)) 4547 RTDirRemove(settingsDir.c_str()); 4548 } 4536 Utf8Str strFullSnapshotFolder; 4537 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 4538 Assert(!strFullSnapshotFolder.isEmpty()); 4539 if (RTDirExists(strFullSnapshotFolder.c_str())) 4540 RTDirRemove(strFullSnapshotFolder.c_str()); 4541 4542 // delete the directory that contains the settings file, but only 4543 // if it matches the VM name 4544 Utf8Str settingsDir; 4545 if (isInOwnDir(&settingsDir)) 4546 RTDirRemove(settingsDir.c_str()); 4549 4547 } 4550 4548 … … 5816 5814 aLogFolder = settingsDir; 5817 5815 else 5818 {5819 5816 /* Log folder is <Machines>/<VM_SnapshotFolder>/Logs */ 5820 Assert(!mUserData->m_strSnapshotFolderFull.isEmpty()); 5821 aLogFolder = mUserData->m_strSnapshotFolderFull; 5822 } 5817 calculateFullPath(mUserData->s.strSnapshotFolder, aLogFolder); 5823 5818 5824 5819 aLogFolder.append(RTPATH_DELIMITER); … … 7717 7712 } 7718 7713 7719 / * update m_strConfigFileFull amd mConfigFile */7714 // update m_strConfigFileFull amd mConfigFile 7720 7715 mData->m_strConfigFileFull = newConfigFile; 7721 7716 // compute the relative path too … … 7731 7726 if (pfNeedsGlobalSaveSettings) 7732 7727 *pfNeedsGlobalSaveSettings = true; 7733 }7734 7735 /* update the snapshot folder */7736 if (RTPathStartsWith(mUserData->m_strSnapshotFolderFull.c_str(),7737 configDir.c_str()))7738 {7739 mUserData->m_strSnapshotFolderFull = Utf8StrFmt("%s%s",7740 newConfigDir.c_str(),7741 mUserData->m_strSnapshotFolderFull.c_str() + configDir.length());7742 copyPathRelativeToMachine(mUserData->m_strSnapshotFolderFull,7743 mUserData->s.strSnapshotFolder);7744 7728 } 7745 7729 … … 8601 8585 aWeight); // weight 8602 8586 8587 Utf8Str strFullSnapshotFolder; 8588 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 8589 8603 8590 ComObjPtr<Medium> diff; 8604 8591 diff.createObject(); 8605 8592 rc = diff->init(mParent, 8606 8593 pMedium->getPreferredDiffFormat(), 8607 Utf8Str(mUserData->m_strSnapshotFolderFull).append(RTPATH_SLASH_STR),8594 strFullSnapshotFolder.append(RTPATH_SLASH_STR), 8608 8595 pMedium->getFirstRegistryMachineId(), // store the diff in the same registry as the parent 8609 8596 pfNeedsSaveSettings); … … 9230 9217 /** 9231 9218 * Returns true if the settings file is located in the directory named exactly 9232 * as the machine . This will be true if the machine settings structure was9233 * created by default in #openConfigLoader().9219 * as the machine; this means, among other things, that the machine directory 9220 * should be auto-renamed. 9234 9221 * 9235 9222 * @param aSettingsDir if not NULL, the full machine settings file directory … … 9241 9228 bool Machine::isInOwnDir(Utf8Str *aSettingsDir /* = NULL */) const 9242 9229 { 9243 Utf8Str settingsDir = mData->m_strConfigFileFull; 9244 settingsDir.stripFilename(); 9245 Utf8Str strDirName = RTPathFilename(settingsDir.c_str()); 9246 9247 AssertReturn(!strDirName.isEmpty(), false); 9248 9249 /* if we don't rename anything on name change, return false shortly */ 9250 if (!mUserData->s.fNameSync) 9251 return false; 9252 9230 Utf8Str strMachineDirName(mData->m_strConfigFileFull); // path/to/machinesfolder/vmname/vmname.vbox 9231 strMachineDirName.stripFilename(); // path/to/machinesfolder/vmname 9253 9232 if (aSettingsDir) 9254 *aSettingsDir = settingsDir; 9255 9256 return strDirName == mUserData->s.strName; 9233 *aSettingsDir = strMachineDirName; 9234 strMachineDirName.stripPath(); // vmname 9235 Utf8Str strConfigFileOnly(mData->m_strConfigFileFull); // path/to/machinesfolder/vmname/vmname.vbox 9236 strConfigFileOnly.stripPath() // vmname.vbox 9237 .stripExt(); // vmname 9238 9239 AssertReturn(!strMachineDirName.isEmpty(), false); 9240 AssertReturn(!strConfigFileOnly.isEmpty(), false); 9241 9242 return strMachineDirName == strConfigFileOnly; 9257 9243 } 9258 9244 … … 10557 10543 if (mData->mMachineState == MachineState_Paused) 10558 10544 { 10545 Utf8Str strFullSnapshotFolder; 10546 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 10559 10547 stateFilePath = Utf8StrFmt("%s%c{%RTuuid}.sav", 10560 mUserData->m_strSnapshotFolderFull.c_str(), 10561 RTPATH_DELIMITER, mData->mUuid.raw()); 10548 strFullSnapshotFolder.c_str(), 10549 RTPATH_DELIMITER, 10550 mData->mUuid.raw()); 10562 10551 } 10563 10552 … … 10925 10914 * @note Locks this object for reading. 10926 10915 */ 10927 HRESULT SessionMachine::onNATRedirectRuleChange(INetworkAdapter *networkAdapter, BOOL aNatRuleRemove, IN_BSTR aRuleName, 10916 HRESULT SessionMachine::onNATRedirectRuleChange(INetworkAdapter *networkAdapter, BOOL aNatRuleRemove, IN_BSTR aRuleName, 10928 10917 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort) 10929 10918 { -
trunk/src/VBox/Main/SnapshotImpl.cpp
r33590 r33904 1386 1386 || mData->mMachineState == MachineState_Saved) 1387 1387 { 1388 Utf8Str strFullSnapshotFolder; 1389 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 1388 1390 strStateFilePath = Utf8StrFmt("%s%c{%RTuuid}.sav", 1389 mUserData->m_strSnapshotFolderFull.c_str(),1391 strFullSnapshotFolder.c_str(), 1390 1392 RTPATH_DELIMITER, 1391 1393 snapshotId.raw()); … … 1855 1857 Utf8Str snapStateFilePath = aTask.pSnapshot->stateFilePath(); 1856 1858 1859 Utf8Str strFullSnapshotFolder; 1860 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 1857 1861 Utf8Str stateFilePath = Utf8StrFmt("%s%c{%RTuuid}.sav", 1858 mUserData->m_strSnapshotFolderFull.c_str(),1862 strFullSnapshotFolder.c_str(), 1859 1863 RTPATH_DELIMITER, 1860 1864 mData->mUuid.raw()); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r33898 r33904 1667 1667 <link to="#registerMachine"/>. 1668 1668 1669 The specified settings file name can be absolute 1670 (full path) or relative to the <link to="IVirtualBox::homeFolder"> 1671 VirtualBox home directory</link>. This file must exist 1672 and must be a valid machine settings file whose contents 1673 will be used to construct the machine object. 1669 The specified settings file name must be fully qualified. 1670 The file must exist and be a valid machine XML settings file 1671 whose contents will be used to construct the machine object. 1674 1672 1675 1673 <result name="VBOX_E_FILE_ERROR"> -
trunk/src/VBox/Main/include/MachineImpl.h
r33848 r33904 215 215 { 216 216 settings::MachineUserData s; 217 Utf8Str m_strSnapshotFolderFull;218 217 }; 219 218 … … 614 613 // callback handlers 615 614 virtual HRESULT onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; } 616 virtual HRESULT onNATRedirectRuleChange(INetworkAdapter * /* networkAdapter */, BOOL /* Remove */, IN_BSTR /* Rule name */, 615 virtual HRESULT onNATRedirectRuleChange(INetworkAdapter * /* networkAdapter */, BOOL /* Remove */, IN_BSTR /* Rule name */, 617 616 NATProtocol_T /* proto */, IN_BSTR /* host ip */, LONG /* host port */, IN_BSTR /* guest ip */, LONG /* guest port */) { return S_OK; } 618 617 virtual HRESULT onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; } … … 957 956 958 957 HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter); 959 HRESULT onNATRedirectRuleChange(INetworkAdapter *networkAdapter, BOOL aNatRuleRemove, IN_BSTR aRuleName, 958 HRESULT onNATRedirectRuleChange(INetworkAdapter *networkAdapter, BOOL aNatRuleRemove, IN_BSTR aRuleName, 960 959 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort); 961 960 HRESULT onStorageControllerChange();
Note:
See TracChangeset
for help on using the changeset viewer.