[llvm-commits] [llvm] r68663 - in /llvm/trunk: include/llvm/System/Path.h lib/System/Path.cpp
Daniel Dunbar
daniel at zuster.org
Wed Apr 8 17:33:09 PDT 2009
Author: ddunbar
Date: Wed Apr 8 19:33:08 2009
New Revision: 68663
URL: http://llvm.org/viewvc/llvm-project?rev=68663&view=rev
Log:
Add sys::Path::makeAbsolute().
Modified:
llvm/trunk/include/llvm/System/Path.h
llvm/trunk/lib/System/Path.cpp
Modified: llvm/trunk/include/llvm/System/Path.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=68663&r1=68662&r2=68663&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Path.h (original)
+++ llvm/trunk/include/llvm/System/Path.h Wed Apr 8 19:33:08 2009
@@ -459,6 +459,10 @@
/// @brief Make the current path name unique in the file system.
bool makeUnique( bool reuse_current /*= true*/, std::string* ErrMsg );
+ /// The current Path name is made absolute by prepending the
+ /// current working directory if necessary.
+ void makeAbsolute();
+
/// @}
/// @name Disk Mutators
/// @{
Modified: llvm/trunk/lib/System/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Path.cpp?rev=68663&r1=68662&r2=68663&view=diff
==============================================================================
--- llvm/trunk/lib/System/Path.cpp (original)
+++ llvm/trunk/lib/System/Path.cpp Wed Apr 8 19:33:08 2009
@@ -207,6 +207,18 @@
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);
More information about the llvm-commits
mailing list