X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fsystem_exec.cc;h=01c46aa9eb62b603922aca904a1a3a3e0ceb34cf;hb=94e084162590da9f61653224362e9da4ce8e3e13;hp=82398af0c84c7854fbd640901dab2a441ce89d73;hpb=5399425f534e2d96d07cf29f427bfa0f39d904b7;p=ardour.git diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc index 82398af0c8..01c46aa9eb 100644 --- a/libs/pbd/system_exec.cc +++ b/libs/pbd/system_exec.cc @@ -43,9 +43,12 @@ #include #endif +#include #define USE_VFORK +#include "pbd/file_utils.h" +#include "pbd/search_path.h" #include "pbd/system_exec.h" using namespace std; @@ -192,8 +195,17 @@ SystemExec::SystemExec (std::string command, const std::map s { init (); make_argp_escaped(command, subs); - cmd = argp[0]; - // cmd = strdup(argp[0]); + + if (find_file (Searchpath (Glib::getenv ("PATH")), argp[0], cmd)) { + // argp[0] exists in $PATH` - set it to the actual path where it was found + free (argp[0]); + argp[0] = strdup(cmd.c_str ()); + } + // else argp[0] not found in path - leave it as-is, it might be an absolute path + + // Glib::find_program_in_path () is only available in Glib >= 2.28 + // cmd = Glib::find_program_in_path (argp[0]); + make_envp(); } @@ -265,14 +277,6 @@ SystemExec::make_argp_escaped(std::string command, const std::map