Changeset 93548 in vbox
- Timestamp:
- Feb 2, 2022 6:08:28 PM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/MachineImpl.h
r93190 r93548 682 682 }; 683 683 684 HRESULT i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings); 684 HRESULT i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings, 685 bool *pfSettingsFileIsNew); 685 686 HRESULT i_saveSettings(bool *pfNeedsGlobalSaveSettings, AutoWriteLock &alock, int aFlags = 0); 686 687 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r93410 r93548 9613 9613 * @note Must be never called directly but only from #saveSettings(). 9614 9614 */ 9615 HRESULT Machine::i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings) 9615 HRESULT Machine::i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings, 9616 bool *pfSettingsFileIsNew) 9616 9617 { 9617 9618 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); … … 9620 9621 9621 9622 bool fSettingsFileIsNew = !mData->pMachineConfigFile->fileExists(); 9622 9623 9623 /// @todo need to handle primary group change, too 9624 9624 … … 9834 9834 9835 9835 /* Note: open flags must correlate with RTFileOpen() in lockConfig() */ 9836 path = Utf8Str(mData->m_strConfigFileFull);9836 path = mData->m_strConfigFileFull; 9837 9837 RTFILE f = NIL_RTFILE; 9838 9838 vrc = RTFileOpen(&f, path.c_str(), … … 9845 9845 RTFileClose(f); 9846 9846 } 9847 if (pfSettingsFileIsNew) 9848 *pfSettingsFileIsNew = fSettingsFileIsNew; 9847 9849 9848 9850 return rc; … … 9877 9879 HRESULT Machine::i_saveSettings(bool *pfNeedsGlobalSaveSettings, 9878 9880 AutoWriteLock &alock, 9879 int 9881 int aFlags /*= 0*/) 9880 9882 { 9881 9883 LogFlowThisFuncEnter(); … … 9896 9898 HRESULT rc = S_OK; 9897 9899 bool fNeedsWrite = false; 9900 bool fSettingsFileIsNew = false; 9898 9901 9899 9902 /* First, prepare to save settings. It will care about renaming the 9900 9903 * settings directory and file if the machine name was changed and about 9901 9904 * creating a new settings file if this is a new machine. */ 9902 rc = i_prepareSaveSettings(pfNeedsGlobalSaveSettings); 9905 rc = i_prepareSaveSettings(pfNeedsGlobalSaveSettings, 9906 &fSettingsFileIsNew); 9903 9907 if (FAILED(rc)) return rc; 9904 9908 … … 9963 9967 // we assume that error info is set by the thrower 9964 9968 rc = err; 9969 9970 // delete any newly created settings file 9971 if (fSettingsFileIsNew) 9972 RTFileDelete(mData->m_strConfigFileFull.c_str()); 9965 9973 9966 9974 // restore old config
Note:
See TracChangeset
for help on using the changeset viewer.