summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Win32/Path.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-15 01:50:13 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-15 01:50:13 +0000
commitf66d93239e0c2d6aadda89e8b0e5890200700422 (patch)
tree94d4e8b7780c41f115813bc0db3746405b7d571c /llvm/lib/System/Win32/Path.cpp
parent320a20ac454b1cbad9e65a889f6b622caf10b2e0 (diff)
downloadbcm5719-llvm-f66d93239e0c2d6aadda89e8b0e5890200700422.tar.gz
bcm5719-llvm-f66d93239e0c2d6aadda89e8b0e5890200700422.zip
For PR351:
* Fix implementation and documentation about LLVMGCCDIR/bytecode-libs * Add the makeUnique method, replacement for getUniqueFilename in Support. * Add the sys::CopyFile function, replacement for CopyFile in Support. * Move GetLLVMConfigDir() into generic code area since its generic. llvm-svn: 18947
Diffstat (limited to 'llvm/lib/System/Win32/Path.cpp')
-rw-r--r--llvm/lib/System/Win32/Path.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/llvm/lib/System/Win32/Path.cpp b/llvm/lib/System/Win32/Path.cpp
index f6e4c3b4763..149b4a1295d 100644
--- a/llvm/lib/System/Win32/Path.cpp
+++ b/llvm/lib/System/Win32/Path.cpp
@@ -158,7 +158,7 @@ Path::GetBytecodeLibraryPaths(std::vector<sys::Path>& Paths) {
}
#ifdef LLVMGCCDIR
{
- Path tmpPath(std::string(LLVMGCCDIR) + "bytecode-libs/");
+ Path tmpPath(std::string(LLVMGCCDIR) + "lib/");
if (tmpPath.readable())
Paths.push_back(tmpPath);
}
@@ -584,6 +584,29 @@ bool Path::getMagicNumber(std::string& Magic, unsigned len) const {
return true;
}
+void
+CopyFile(const sys::Path &Dest, const sys::Path &Src) {
+ if (!::CopyFile(Src.c_str(), Dest.c_str(), false))
+ ThrowError("Can't copy '" + Src.toString() +
+ "' to '" + Dest.toString() + "'");
+}
+
+void
+Path::makeUnique() {
+ if (!exists())
+ return; // File doesn't exist already, just use it!
+
+ Path dir (*this);
+ dir.elideFile();
+ std::string fname = this->getLast();
+
+ char* newName = alloca(MAX_PATH+1);
+ if (!GetTempFileName(dir.c_str(), fname.c_str(), 0, newName))
+ ThrowError("Cannot make unique filename for '" + path + "'");
+
+ path = newName;
+}
+
}
}
OpenPOWER on IntegriCloud