diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-28 16:25:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-28 16:25:49 +0200 |
commit | 05a398f967bb030c6dbb9d6458340767325e46f4 (patch) | |
tree | fd4699b38809a9a24b0ee317a15f61118aa7b3e5 /libbutl/process.hxx | |
parent | 822059e4e69547f8e97a1cd219912f55826b0414 (diff) |
Add ability to restrict executable search to PATH only
Diffstat (limited to 'libbutl/process.hxx')
-rw-r--r-- | libbutl/process.hxx | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libbutl/process.hxx b/libbutl/process.hxx index cd692ca..3e1a990 100644 --- a/libbutl/process.hxx +++ b/libbutl/process.hxx @@ -313,8 +313,14 @@ namespace butl // This, for example, can be used to implement the Windows "search in the // parent executable's directory" semantics across platforms. // + // If path_only is true then only search in the PATH environment variable + // (or in CWD if there is a directory component) ignorting other places + // (like calling process' directory and, gasp, CWD on Windows). + // static process_path - path_search (const char*& args0, const dir_path& fallback = dir_path ()); + path_search (const char*& args0, + const dir_path& fallback = dir_path (), + bool path_only = false); // This version is primarily useful when you want to pre-search the // executable before creating the args[] array. In this case you will @@ -330,25 +336,31 @@ namespace butl // the same). // static process_path - path_search (const char* file, bool init, const dir_path& = dir_path ()); + path_search (const char* file, bool init, + const dir_path& = dir_path (), bool = false); static process_path - path_search (const std::string&, bool, const dir_path& = dir_path ()); + path_search (const std::string&, bool, + const dir_path& = dir_path (), bool = false); static process_path - path_search (const path&, bool, const dir_path& = dir_path ()); + path_search (const path&, bool, + const dir_path& = dir_path (), bool = false); // As above but if not found return empty process_path instead of // throwing. // static process_path - try_path_search (const char*, bool, const dir_path& = dir_path ()); + try_path_search (const char*, bool, + const dir_path& = dir_path (), bool = false); static process_path - try_path_search (const std::string&, bool, const dir_path& = dir_path ()); + try_path_search (const std::string&, bool, + const dir_path& = dir_path (), bool = false); static process_path - try_path_search (const path&, bool, const dir_path& = dir_path ()); + try_path_search (const path&, bool, + const dir_path& = dir_path (), bool = false); // Print process commmand line. If the number of elements is specified, // then it will print the piped multi-process command line, if present. |