summaryrefslogtreecommitdiff
path: root/lib/System
diff options
context:
space:
mode:
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Unix/Program.inc4
-rw-r--r--lib/System/Win32/Program.inc6
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index 86d9b2a1d9..e06f80ba83 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -66,8 +66,8 @@ Program::FindProgramByName(const std::string& progName) {
if (progName.find('/') != std::string::npos)
return temp;
- // At this point, the file name does not contain slashes. Search for it
- // through the directories specified in the PATH environment variable.
+ // 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.
// Get the path. If its empty, we can't do anything to find it.
const char *PathStr = getenv("PATH");
diff --git a/lib/System/Win32/Program.inc b/lib/System/Win32/Program.inc
index b55aa2fa80..2d6e665377 100644
--- a/lib/System/Win32/Program.inc
+++ b/lib/System/Win32/Program.inc
@@ -67,10 +67,12 @@ Program::FindProgramByName(const std::string& progName) {
Path temp;
if (!temp.set(progName)) // invalid name
return Path();
- if (temp.canExecute()) // already executable as is
+ // Return paths with slashes verbatim.
+ if (progName.find('\\') != std::string::npos ||
+ progName.find('/') != std::string::npos)
return temp;
- // At this point, the file name is valid and its not executable.
+ // At this point, the file name is valid and does not contain slashes.
// Let Windows search for it.
char buffer[MAX_PATH];
char *dummy = NULL;