mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
Add sys::Path::makeAbsolute().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68663 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2eb65e292c
commit
6ddf2c1930
@ -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
|
||||
/// @{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user