]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/sg_dir.cxx
Revert "Use simgear internal stuff for the singleton class."
[simgear.git] / simgear / misc / sg_dir.cxx
index 1514c9501a38497cd7a1080e078fc5ea2110753b..a9969e07089cf8e37581eaa274f317d95093266f 100644 (file)
@@ -96,11 +96,14 @@ Dir Dir::tempDir(const std::string& templ)
     char buf[1024];
     const char* tempPath = ::getenv("TMPDIR");
     if (!tempPath) {
-        tempPath = "/tmp/";
+        tempPath = "/tmp";
     }
+    SGPath p(tempPath);
+    p.append(templ);
     // Mac OS-X / BSD manual says any number of 'X's, but GLibc manual
     // says exactly six, so that's what I'm going with
-    ::snprintf(buf, 1024, "%s%s-XXXXXX", tempPath, templ.c_str());
+    p.concat("-XXXXXX");
+    ::snprintf(buf, 1024, "%s", p.c_str());
     if (!mkdtemp(buf)) {
         SG_LOG(SG_IO, SG_WARN, "mkdtemp failed:" << strerror(errno));
         return Dir();