mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 06:25:18 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18947 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user