Index: /trunk/include/VBox/com/string.h
===================================================================
--- /trunk/include/VBox/com/string.h	(revision 35127)
+++ /trunk/include/VBox/com/string.h	(revision 35128)
@@ -552,9 +552,4 @@
 
     /**
-     * Converts all '\' characters into '/'.
-     */
-    Utf8Str& useForwardSlashes();
-
-    /**
      *  Static immutable empty-string object. May be used for comparison purposes.
      */
Index: /trunk/include/iprt/cpp/ministring.h
===================================================================
--- /trunk/include/iprt/cpp/ministring.h	(revision 35127)
+++ /trunk/include/iprt/cpp/ministring.h	(revision 35128)
@@ -664,4 +664,14 @@
 
     /**
+     * Replaces all occurences of cFind with cReplace in the member string.
+     * In order not to produce invalid UTF-8, the characters must be ASCII
+     * values less than 128; this is not verified.
+     *
+     * @param cFind Character to replace. Must be ASCII < 128.
+     * @param cReplace Character to replace cFind with. Must be ASCII < 128.
+     */
+    void findReplace(char cFind, char cReplace);
+
+    /**
      * Returns a substring of "this" as a new Utf8Str.
      *
Index: /trunk/include/iprt/cpp/xml.h
===================================================================
--- /trunk/include/iprt/cpp/xml.h	(revision 35127)
+++ /trunk/include/iprt/cpp/xml.h	(revision 35128)
@@ -454,4 +454,5 @@
     bool getAttributeValue(const char *pcszMatch, const char *&ppcsz) const;
     bool getAttributeValue(const char *pcszMatch, iprt::MiniString &str) const;
+    bool getAttributeValuePath(const char *pcszMatch, iprt::MiniString &str) const;
     bool getAttributeValue(const char *pcszMatch, int32_t &i) const;
     bool getAttributeValue(const char *pcszMatch, uint32_t &i) const;
@@ -473,4 +474,5 @@
         return setAttribute(pcszName, strValue.c_str());
     }
+    AttributeNode* setAttributePath(const char *pcszName, const iprt::MiniString &strValue);
     AttributeNode* setAttribute(const char *pcszName, int32_t i);
     AttributeNode* setAttribute(const char *pcszName, uint32_t i);
Index: /trunk/src/VBox/Main/glue/string.cpp
===================================================================
--- /trunk/src/VBox/Main/glue/string.cpp	(revision 35127)
+++ /trunk/src/VBox/Main/glue/string.cpp	(revision 35128)
@@ -133,16 +133,4 @@
 }
 
-Utf8Str& Utf8Str::useForwardSlashes()
-{
-    for (size_t i = 0; i < length(); ++i)
-    {
-        char *p = &m_psz[i];
-        if (*p == '\\')
-            *p = '/';
-    }
-
-    return *this;
-}
-
 /**
  * Internal function used in Utf8Str copy constructors and assignment when
Index: /trunk/src/VBox/Main/xml/Settings.cpp
===================================================================
--- /trunk/src/VBox/Main/xml/Settings.cpp	(revision 35127)
+++ /trunk/src/VBox/Main/xml/Settings.cpp	(revision 35128)
@@ -647,10 +647,6 @@
             if (fNeedsFilePath)
             {
-                if (!(pelmImage->getAttributeValue("filePath", med.strLocation)))
+                if (!(pelmImage->getAttributeValuePath("filePath", med.strLocation)))
                     throw ConfigFileError(this, &elmMedium, N_("Required %s/@filePath attribute is missing"), elmMedium.getName());
-                else
-                    // IPRT can handle forward slashes in file paths everywhere, but there might be
-                    // backslashes in the settings file, so convert them into forward slashes.
-                    med.strLocation.useForwardSlashes();
             }
         }
@@ -1011,8 +1007,5 @@
     pelmMedium->setAttribute("uuid", mdm.uuid.toStringCurly());
 
-    // always use forward slashes when writing out settings, never '\'
-    Utf8Str strLocation(mdm.strLocation);
-    strLocation.useForwardSlashes();
-    pelmMedium->setAttribute("location", strLocation);
+    pelmMedium->setAttributePath("location", mdm.strLocation);
 
     pelmMedium->setAttribute("format", mdm.strFormat);
@@ -3061,5 +3054,5 @@
     parseTimestamp(snap.timestamp, strTemp);
 
-    elmSnapshot.getAttributeValue("stateFile", snap.strStateFile);      // online snapshots only
+    elmSnapshot.getAttributeValuePath("stateFile", snap.strStateFile);      // online snapshots only
 
     // parse Hardware before the other elements because other things depend on it
@@ -3184,12 +3177,10 @@
             convertOldOSType_pre1_5(machineUserData.strOsType);
 
-        elmMachine.getAttributeValue("stateFile", strStateFile);
+        elmMachine.getAttributeValuePath("stateFile", strStateFile);
+
         if (elmMachine.getAttributeValue("currentSnapshot", str))
             parseUUID(uuidCurrentSnapshot, str);
 
-        elmMachine.getAttributeValue("snapshotFolder", machineUserData.strSnapshotFolder);
-        // IPRT can handle forward slashes in file paths everywhere, but there might be
-        // backslashes in the settings file, so convert them into forward slashes.
-        machineUserData.strSnapshotFolder.useForwardSlashes();
+        elmMachine.getAttributeValuePath("snapshotFolder", machineUserData.strSnapshotFolder);
 
         if (!elmMachine.getAttributeValue("currentStateModified", fCurrentStateModified))
@@ -4122,5 +4113,5 @@
 
     if (snap.strStateFile.length())
-        pelmSnapshot->setAttribute("stateFile", snap.strStateFile);
+        pelmSnapshot->setAttributePath("stateFile", snap.strStateFile);
 
     if (snap.strDescription.length())
@@ -4210,5 +4201,5 @@
          && !(fl & BuildMachineXML_SuppressSavedState)
        )
-        elmMachine.setAttribute("stateFile", strStateFile);
+        elmMachine.setAttributePath("stateFile", strStateFile);
     if (    (fl & BuildMachineXML_IncludeSnapshots)
          && !uuidCurrentSnapshot.isEmpty())
@@ -4216,10 +4207,5 @@
 
     if (machineUserData.strSnapshotFolder.length())
-    {
-        // always use forward slashes when writing out settings, never '\'
-        Utf8Str strSnapshotFolder(machineUserData.strSnapshotFolder);
-        strSnapshotFolder.useForwardSlashes();
-        elmMachine.setAttribute("snapshotFolder", strSnapshotFolder);
-    }
+        elmMachine.setAttributePath("snapshotFolder", machineUserData.strSnapshotFolder);
     if (!fCurrentStateModified)
         elmMachine.setAttribute("currentStateModified", fCurrentStateModified);
Index: /trunk/src/VBox/Runtime/common/string/ministring.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/string/ministring.cpp	(revision 35127)
+++ /trunk/src/VBox/Runtime/common/string/ministring.cpp	(revision 35128)
@@ -212,4 +212,14 @@
 
     return npos;
+}
+
+void MiniString::findReplace(char cFind, char cReplace)
+{
+    for (size_t i = 0; i < length(); ++i)
+    {
+        char *p = &m_psz[i];
+        if (*p == cFind)
+            *p = cReplace;
+    }
 }
 
Index: /trunk/src/VBox/Runtime/r3/xml.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/xml.cpp	(revision 35127)
+++ /trunk/src/VBox/Runtime/r3/xml.cpp	(revision 35128)
@@ -831,4 +831,22 @@
     {
         str = pAttr->getValue();
+        return true;
+    }
+
+    return false;
+}
+
+/**
+ * Like getAttributeValue (ministring variant), but makes sure that all backslashes
+ * are converted to forward slashes.
+ * @param pcszMatch
+ * @param str
+ * @return
+ */
+bool ElementNode::getAttributeValuePath(const char *pcszMatch, iprt::MiniString &str) const
+{
+    if (getAttributeValue(pcszMatch, str))
+    {
+        str.findReplace('\\', '/');
         return true;
     }
@@ -1054,4 +1072,18 @@
 
 /**
+ * Like setAttribute (ministring variant), but replaces all backslashes with forward slashes
+ * before calling that one.
+ * @param pcszName
+ * @param strValue
+ * @return
+ */
+AttributeNode* ElementNode::setAttributePath(const char *pcszName, const iprt::MiniString &strValue)
+{
+    iprt::MiniString strTemp(strValue);
+    strTemp.findReplace('\\', '/');
+    return setAttribute(pcszName, strTemp.c_str());
+}
+
+/**
  * Sets the given attribute; overloaded version for int32_t.
  *
