mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-05 19:29:54 +00:00
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
This commit is contained in:
parent
b09916bdfb
commit
e1b332a304
@ -662,6 +662,10 @@ namespace sys {
|
|||||||
/// @returns true if an error occurs, false otherwise
|
/// @returns true if an error occurs, false otherwise
|
||||||
/// @brief Copy one file to another.
|
/// @brief Copy one file to another.
|
||||||
bool CopyFile(const Path& Dest, const Path& Src, std::string* ErrMsg);
|
bool CopyFile(const Path& Dest, const Path& Src, std::string* ErrMsg);
|
||||||
|
|
||||||
|
/// This is the OS-specific path separator: a colon on Unix or a semicolon
|
||||||
|
/// on Windows.
|
||||||
|
extern const char PathSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath);
|
std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath);
|
||||||
|
@ -177,6 +177,25 @@ Path::getSuffix() const {
|
|||||||
return path.substr(path.rfind('.') + 1);
|
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.
|
// Include the truly platform-specific parts of this class.
|
||||||
#if defined(LLVM_ON_UNIX)
|
#if defined(LLVM_ON_UNIX)
|
||||||
#include "Unix/Path.inc"
|
#include "Unix/Path.inc"
|
||||||
|
@ -63,6 +63,8 @@ inline bool lastIsSlash(const std::string& path) {
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
using namespace sys;
|
using namespace sys;
|
||||||
|
|
||||||
|
extern const char sys::PathSeparator = ':';
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::isValid() const {
|
Path::isValid() const {
|
||||||
// Check some obvious things
|
// Check some obvious things
|
||||||
@ -183,25 +185,6 @@ Path::GetTemporaryDirectory(std::string* ErrMsg ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getPathList(const char*path, std::vector<sys::Path>& Paths) {
|
|
||||||
const char* at = path;
|
|
||||||
const char* delim = strchr(at, ':');
|
|
||||||
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, ':');
|
|
||||||
}
|
|
||||||
if (*at != 0)
|
|
||||||
if (tmpPath.set(std::string(at)))
|
|
||||||
if (tmpPath.canRead())
|
|
||||||
Paths.push_back(tmpPath);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) {
|
Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) {
|
||||||
#ifdef LTDL_SHLIBPATH_VAR
|
#ifdef LTDL_SHLIBPATH_VAR
|
||||||
|
@ -45,6 +45,8 @@ static void FlipBackSlashes(std::string& s) {
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace sys {
|
namespace sys {
|
||||||
|
|
||||||
|
extern const char sys::PathSeparator = ';';
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::isValid() const {
|
Path::isValid() const {
|
||||||
if (path.empty())
|
if (path.empty())
|
||||||
@ -164,25 +166,6 @@ Path::GetRootDirectory() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getPathList(const char*path, std::vector<sys::Path>& Paths) {
|
|
||||||
const char* at = path;
|
|
||||||
const char* delim = strchr(at, ';');
|
|
||||||
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, ';');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*at != 0)
|
|
||||||
if (tmpPath.set(std::string(at)))
|
|
||||||
if (tmpPath.canRead())
|
|
||||||
Paths.push_back(tmpPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) {
|
Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) {
|
||||||
Paths.push_back(sys::Path("C:/WINDOWS/SYSTEM32"));
|
Paths.push_back(sys::Path("C:/WINDOWS/SYSTEM32"));
|
||||||
|
Loading…
Reference in New Issue
Block a user