[llvm-commits] CVS: llvm/lib/System/SunOS/Path.cpp

Reid Spencer reid at x10sys.com
Mon Aug 30 14:47:06 PDT 2004



Changes in directory llvm/lib/System/SunOS:

Path.cpp updated: 1.1 -> 1.2
---
Log message:

Move the GetTemporaryDirectory function from "generic Unix" to platform
specific.


---
Diffs of the changes:  (+14 -0)

Index: llvm/lib/System/SunOS/Path.cpp
diff -u llvm/lib/System/SunOS/Path.cpp:1.1 llvm/lib/System/SunOS/Path.cpp:1.2
--- llvm/lib/System/SunOS/Path.cpp:1.1	Sun Aug 29 00:24:01 2004
+++ llvm/lib/System/SunOS/Path.cpp	Mon Aug 30 16:46:55 2004
@@ -33,6 +33,20 @@
   return true;
 }
 
+Path
+Path::GetTemporaryDirectory() {
+  char* pathname = tempnam(0,"llvm_");
+  if (0 == pathname)
+    ThrowErrno(std::string("Can't create temporary directory name"));
+  Path result;
+  result.set_directory(pathname);
+  free(pathname);
+  assert(result.is_valid() && "tempnam didn't create a valid pathname!");
+  if (0 != mkdir(result.c_str(), S_IRWXU))
+    ThrowErrno(result.get() + ": Can't create temporary directory");
+  return result;
+}
+
 }
 
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab






More information about the llvm-commits mailing list