forked from OSchip/llvm-project
parent
b58973f918
commit
8cc6dc26bb
|
@ -111,11 +111,6 @@ namespace sys {
|
|||
/// directory.
|
||||
static Path GetTemporaryDirectory(std::string* ErrMsg = 0);
|
||||
|
||||
/// Construct a vector of sys::Path that contains the "standard" system
|
||||
/// library paths suitable for linking into programs.
|
||||
/// @brief Construct a path to the system library directory
|
||||
static void GetSystemLibraryPaths(std::vector<sys::Path>& Paths);
|
||||
|
||||
/// Construct a path to the current user's home directory. The
|
||||
/// implementation must use an operating system specific mechanism for
|
||||
/// determining the user's home directory. For example, the environment
|
||||
|
|
|
@ -95,25 +95,6 @@ bool Path::hasMagicNumber(StringRef Magic) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static StringRef getDirnameCharSep(StringRef path, const char *Sep) {
|
||||
assert(Sep[0] != '\0' && Sep[1] == '\0' &&
|
||||
"Sep must be a 1-character string literal.");
|
||||
|
|
|
@ -207,21 +207,6 @@ Path::GetTemporaryDirectory(std::string *ErrMsg) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) {
|
||||
#ifdef LTDL_SHLIBPATH_VAR
|
||||
char* env_var = getenv(LTDL_SHLIBPATH_VAR);
|
||||
if (env_var != 0) {
|
||||
getPathList(env_var,Paths);
|
||||
}
|
||||
#endif
|
||||
// FIXME: Should this look at LD_LIBRARY_PATH too?
|
||||
Paths.push_back(sys::Path("/usr/local/lib/"));
|
||||
Paths.push_back(sys::Path("/usr/X11R6/lib/"));
|
||||
Paths.push_back(sys::Path("/usr/lib/"));
|
||||
Paths.push_back(sys::Path("/lib/"));
|
||||
}
|
||||
|
||||
Path
|
||||
Path::GetUserHomeDirectory() {
|
||||
const char* home = getenv("HOME");
|
||||
|
|
|
@ -241,36 +241,6 @@ Path::GetRootDirectory() {
|
|||
return Path("file:///");
|
||||
}
|
||||
|
||||
void
|
||||
Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) {
|
||||
char buff[MAX_PATH];
|
||||
// Generic form of C:\Windows\System32
|
||||
HRESULT res = SHGetFolderPathA(NULL,
|
||||
CSIDL_FLAG_CREATE | CSIDL_SYSTEM,
|
||||
NULL,
|
||||
SHGFP_TYPE_CURRENT,
|
||||
buff);
|
||||
if (res != S_OK) {
|
||||
assert(0 && "Failed to get system directory");
|
||||
return;
|
||||
}
|
||||
Paths.push_back(sys::Path(buff));
|
||||
|
||||
// Reset buff.
|
||||
buff[0] = 0;
|
||||
// Generic form of C:\Windows
|
||||
res = SHGetFolderPathA(NULL,
|
||||
CSIDL_FLAG_CREATE | CSIDL_WINDOWS,
|
||||
NULL,
|
||||
SHGFP_TYPE_CURRENT,
|
||||
buff);
|
||||
if (res != S_OK) {
|
||||
assert(0 && "Failed to get windows directory");
|
||||
return;
|
||||
}
|
||||
Paths.push_back(sys::Path(buff));
|
||||
}
|
||||
|
||||
Path
|
||||
Path::GetUserHomeDirectory() {
|
||||
char buff[MAX_PATH];
|
||||
|
|
Loading…
Reference in New Issue