Changeset 34837 in vbox for trunk/src/VBox
- Timestamp:
- Dec 8, 2010 2:37:42 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/string.cpp
r33805 r34837 97 97 } 98 98 99 Utf8Str& Utf8Str::useForwardSlashes() 100 { 101 for (size_t i = 0; i < length(); ++i) 102 { 103 char *p = &m_psz[i]; 104 if (*p == '\\') 105 *p = '/'; 106 } 107 108 return *this; 109 } 110 99 111 /** 100 112 * Internal function used in Utf8Str copy constructors and assignment when -
trunk/src/VBox/Main/xml/Settings.cpp
r34598 r34837 646 646 647 647 if (fNeedsFilePath) 648 { 648 649 if (!(pelmImage->getAttributeValue("filePath", med.strLocation))) 649 650 throw ConfigFileError(this, &elmMedium, N_("Required %s/@filePath attribute is missing"), elmMedium.getName()); 651 else 652 // IPRT can handle forward slashes in file paths everywhere, but there might be 653 // backslashes in the settings file, so convert them into forward slashes. 654 med.strLocation.useForwardSlashes(); 655 } 650 656 } 651 657 … … 1002 1008 1003 1009 pelmMedium->setAttribute("uuid", mdm.uuid.toStringCurly()); 1004 pelmMedium->setAttribute("location", mdm.strLocation); 1010 1011 // always use forward slashes when writing out settings, never '\' 1012 Utf8Str strLocation(mdm.strLocation); 1013 strLocation.useForwardSlashes(); 1014 pelmMedium->setAttribute("location", strLocation); 1015 1005 1016 pelmMedium->setAttribute("format", mdm.strFormat); 1006 1017 if (mdm.fAutoReset) … … 3168 3179 if (elmMachine.getAttributeValue("currentSnapshot", str)) 3169 3180 parseUUID(uuidCurrentSnapshot, str); 3181 3170 3182 elmMachine.getAttributeValue("snapshotFolder", machineUserData.strSnapshotFolder); 3183 // IPRT can handle forward slashes in file paths everywhere, but there might be 3184 // backslashes in the settings file, so convert them into forward slashes. 3185 machineUserData.strSnapshotFolder.useForwardSlashes(); 3186 3171 3187 if (!elmMachine.getAttributeValue("currentStateModified", fCurrentStateModified)) 3172 3188 fCurrentStateModified = true; … … 4190 4206 && !uuidCurrentSnapshot.isEmpty()) 4191 4207 elmMachine.setAttribute("currentSnapshot", uuidCurrentSnapshot.toStringCurly()); 4208 4192 4209 if (machineUserData.strSnapshotFolder.length()) 4193 elmMachine.setAttribute("snapshotFolder", machineUserData.strSnapshotFolder); 4210 { 4211 // always use forward slashes when writing out settings, never '\' 4212 Utf8Str strSnapshotFolder(machineUserData.strSnapshotFolder); 4213 strSnapshotFolder.useForwardSlashes(); 4214 elmMachine.setAttribute("snapshotFolder", strSnapshotFolder); 4215 } 4194 4216 if (!fCurrentStateModified) 4195 4217 elmMachine.setAttribute("currentStateModified", fCurrentStateModified);
Note:
See TracChangeset
for help on using the changeset viewer.