diff options
author | Chris Lattner <sabre@nondot.org> | 2008-02-27 06:17:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-02-27 06:17:10 +0000 |
commit | e1b332a30459a726e882a4f484a9a31f2cea9e29 (patch) | |
tree | a8c682ec5e545f6b8bb6de9876338a63b06b164b /lib/System/Path.cpp | |
parent | b09916bdfbd7ffdc8fbadb5ee0c0b50567823f46 (diff) |
Add path separator support, patch by Sam Bishop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47662 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Path.cpp')
-rw-r--r-- | lib/System/Path.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp index 11035cfee7..8a1de75e47 100644 --- a/lib/System/Path.cpp +++ b/lib/System/Path.cpp @@ -177,6 +177,25 @@ Path::getSuffix() const { return path.substr(path.rfind('.') + 1); } +static void getPathList(const char*path, std::vector<Path>& Paths) { + const char* at = path; + const char* delim = strchr(at, PathSeparator); + Path tmpPath; + while (delim != 0) { + std::string tmp(at, size_t(delim-at)); + if (tmpPath.set(tmp)) + if (tmpPath.canRead()) + Paths.push_back(tmpPath); + at = delim + 1; + delim = strchr(at, PathSeparator); + } + + if (*at != 0) + if (tmpPath.set(std::string(at))) + if (tmpPath.canRead()) + Paths.push_back(tmpPath); +} + // Include the truly platform-specific parts of this class. #if defined(LLVM_ON_UNIX) #include "Unix/Path.inc" |