summaryrefslogtreecommitdiff
path: root/lib/Support/Unix
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-13 19:25:37 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-13 19:25:37 +0000
commit6585b388cb7bfc623adb9e4dd910423f838e5d96 (patch)
treedc0ff4c6888d3a35bc3dec2152d921fd929e4008 /lib/Support/Unix
parent90cd06e90be1db06bc4812ae9ec96b6638847285 (diff)
downloadllvm-6585b388cb7bfc623adb9e4dd910423f838e5d96.tar.gz
llvm-6585b388cb7bfc623adb9e4dd910423f838e5d96.tar.bz2
llvm-6585b388cb7bfc623adb9e4dd910423f838e5d96.tar.xz
Have sys::FindProgramByName return a std::string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/Program.inc14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc
index d8bdd6ce42..5fa421b917 100644
--- a/lib/Support/Unix/Program.inc
+++ b/lib/Support/Unix/Program.inc
@@ -48,19 +48,19 @@ namespace llvm {
using namespace sys;
// This function just uses the PATH environment variable to find the program.
-Path
+std::string
sys::FindProgramByName(const std::string& progName) {
// Check some degenerate cases
if (progName.length() == 0) // no program
- return Path();
+ return "";
Path temp;
if (!temp.set(progName)) // invalid name
- return Path();
+ return "";
// Use the given path verbatim if it contains any slashes; this matches
// the behavior of sh(1) and friends.
if (progName.find('/') != std::string::npos)
- return temp;
+ return temp.str();
// At this point, the file name is valid and does not contain slashes. Search
// for it through the directories specified in the PATH environment variable.
@@ -68,7 +68,7 @@ sys::FindProgramByName(const std::string& progName) {
// Get the path. If its empty, we can't do anything to find it.
const char *PathStr = getenv("PATH");
if (PathStr == 0)
- return Path();
+ return "";
// Now we have a colon separated list of directories to search; try them.
size_t PathLen = strlen(PathStr);
@@ -81,7 +81,7 @@ sys::FindProgramByName(const std::string& progName) {
if (FilePath.set(std::string(PathStr,Colon))) {
FilePath.appendComponent(progName);
if (FilePath.canExecute())
- return FilePath; // Found the executable!
+ return FilePath.str(); // Found the executable!
}
// Nope it wasn't in this directory, check the next path in the list!
@@ -94,7 +94,7 @@ sys::FindProgramByName(const std::string& progName) {
PathLen--;
}
}
- return Path();
+ return "";
}
static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) {