Changeset 23334 in vbox for trunk/src/VBox/Main/xml/Settings.cpp
- Timestamp:
- Sep 25, 2009 2:37:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r23304 r23334 2761 2761 2762 2762 /** 2763 * Called from Main code to write a machine config file to disk. This builds a DOM tree from 2764 * the member variables and then writes the XML file; it throws xml::Error instances on errors, 2765 * in particular if the file cannot be written. 2766 */ 2767 void MachineConfigFile::write(const com::Utf8Str &strFilename) 2768 { 2769 // createStubDocument() sets the settings version to at least 1.7; however, 2770 // we might need to enfore a later settings version if incompatible settings 2771 // are present: 2763 * Called from write() before calling ConfigFileBase::createStubDocument(). 2764 * This adjusts the settings version in m->sv if incompatible settings require 2765 * a settings bump, whereas otherwise we try to preserve the settings version 2766 * to avoid breaking compatibility with older versions. 2767 */ 2768 void MachineConfigFile::bumpSettingsVersionIfNeeded() 2769 { 2772 2770 if (m->sv < SettingsVersion_v1_8) 2773 2771 { … … 2798 2796 if (att.deviceType == DeviceType_DVD) 2799 2797 { 2800 if ( (cDVDs) // more than one DVD? 2801 || (sctl.storageBus != StorageBus_IDE) // DVD at bus other than DVD? 2802 || (att.lPort != 1) // DVDs not at primary master? 2798 if ( (sctl.storageBus != StorageBus_IDE) // DVD at bus other than DVD? 2799 || (att.lPort != 1) // DVDs not at secondary master? 2803 2800 || (att.lDevice != 0) 2804 2801 ) … … 2811 2808 } 2812 2809 else if (att.deviceType == DeviceType_Floppy) 2813 {2814 if (cFloppies)2815 // more than one floppy: new settings format2816 m->sv = SettingsVersion_v1_9;2817 2818 2810 ++cFloppies; 2819 } 2820 } 2821 } 2811 } 2812 } 2813 2814 // VirtualBox before 3.1 had exactly one floppy and exactly one DVD, 2815 // so any deviation from that will require settings version 1.9 2816 if ( (m->sv < SettingsVersion_v1_9) 2817 && ( (cDVDs != 1) 2818 || (cFloppies > 1) 2819 ) 2820 ) 2821 m->sv = SettingsVersion_v1_9; 2822 2822 } 2823 2823 … … 2828 2828 m->sv = SettingsVersion_v1_9; 2829 2829 } 2830 2830 } 2831 2832 /** 2833 * Called from Main code to write a machine config file to disk. This builds a DOM tree from 2834 * the member variables and then writes the XML file; it throws xml::Error instances on errors, 2835 * in particular if the file cannot be written. 2836 */ 2837 void MachineConfigFile::write(const com::Utf8Str &strFilename) 2838 { 2831 2839 try 2832 2840 { 2841 // createStubDocument() sets the settings version to at least 1.7; however, 2842 // we might need to enfore a later settings version if incompatible settings 2843 // are present: 2844 bumpSettingsVersionIfNeeded(); 2845 2833 2846 m->strFilename = strFilename; 2834 2847 createStubDocument();
Note:
See TracChangeset
for help on using the changeset viewer.