If the file the user specifies can't be found in the current directory,
and the user didn't specify a particular directory, search for the file
using the $PATH environment variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113575 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/Driver.cpp b/tools/driver/Driver.cpp
index 10ab1a1..10911da 100644
--- a/tools/driver/Driver.cpp
+++ b/tools/driver/Driver.cpp
@@ -527,6 +527,13 @@
SBFileSpec file(optarg);
if (file.Exists())
m_option_data.m_filename = optarg;
+ else if (file.ResolveExecutableLocation())
+ {
+ char path[PATH_MAX];
+ int path_len;
+ file.GetPath (path, path_len);
+ m_option_data.m_filename = path;
+ }
else
error.SetErrorStringWithFormat("file specified in --file (-f) option doesn't exist: '%s'", optarg);
}
@@ -550,6 +557,14 @@
SBFileSpec file(optarg);
if (file.Exists())
m_option_data.m_source_command_files.push_back (optarg);
+ else if (file.ResolveExecutableLocation())
+ {
+ char final_path[PATH_MAX];
+ size_t path_len;
+ file.GetPath (final_path, path_len);
+ std::string path_str (final_path);
+ m_option_data.m_source_command_files.push_back (path_str);
+ }
else
error.SetErrorStringWithFormat("file specified in --source (-s) option doesn't exist: '%s'", optarg);
}