1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Add sys::Path::makeAbsolute().

llvm-svn: 68663
This commit is contained in:
Daniel Dunbar 2009-04-09 00:33:08 +00:00
parent 1c83e8d3ec
commit 7682ffcabb
2 changed files with 16 additions and 0 deletions

View File

@ -459,6 +459,10 @@ namespace sys {
/// @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
/// @{

View File

@ -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);