summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Path.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-09 00:33:08 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-09 00:33:08 +0000
commit3f48987069db68bf39db1d4081ea2f5262a35dff (patch)
treef8d1bfa2bbc09ace6b8c13d92a4de956d9df79c2 /llvm/lib/System/Path.cpp
parentd937ed386eb4997dbf403932c05da78a80f37b49 (diff)
downloadbcm5719-llvm-3f48987069db68bf39db1d4081ea2f5262a35dff.tar.gz
bcm5719-llvm-3f48987069db68bf39db1d4081ea2f5262a35dff.zip
Add sys::Path::makeAbsolute().
llvm-svn: 68663
Diffstat (limited to 'llvm/lib/System/Path.cpp')
-rw-r--r--llvm/lib/System/Path.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/System/Path.cpp b/llvm/lib/System/Path.cpp
index c5a4b0676ff..4c965db7223 100644
--- a/llvm/lib/System/Path.cpp
+++ b/llvm/lib/System/Path.cpp
@@ -207,6 +207,18 @@ bool Path::hasMagicNumber(const std::string &Magic) const {
return false;
}
+void Path::makeAbsolute() {
+ if (isAbsolute())
+ return;
+
+ Path CWD = Path::GetCurrentDirectory();
+ assert(CWD.isAbsolute() && "GetCurrentDirectory returned relative path!");
+
+ CWD.appendComponent(path);
+
+ path = CWD.toString();
+}
+
static void getPathList(const char*path, std::vector<Path>& Paths) {
const char* at = path;
const char* delim = strchr(at, PathSeparator);
OpenPOWER on IntegriCloud