]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/sg_path.cxx
Terrasync: make whitespace in pathnames work under windows
[simgear.git] / simgear / misc / sg_path.cxx
index 6e549f6d1702e652ff6a759b0b3aac01fa186644..20dd4fbcea2c4400efcfc64fc6d78b69f1078a2b 100644 (file)
@@ -366,3 +366,20 @@ bool SGPath::isNull() const
 {
   return path.empty() || (path == "");
 }
+
+std::string SGPath::str_native() const
+{
+#ifdef _WIN32
+    std::string s = str();
+    std::string::size_type pos;
+    std::string nativeSeparator;
+    nativeSeparator = sgDirPathSepBad;
+
+    while( (pos=s.find( sgDirPathSep )) != std::string::npos ) {
+        s.replace( pos, 1, nativeSeparator );
+    }
+    return s;
+#else
+    return str();
+#endif
+}