From: Mikko Rasa Date: Sun, 3 Sep 2023 23:16:56 +0000 (+0300) Subject: Fix processing of PATH on Windows X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=6098a8bcef5508aabf9171108c9a10965e5f8d13;p=builder.git Fix processing of PATH on Windows Also always add the bin directory of the install prefix. --- diff --git a/source/lib/virtualfilesystem.cpp b/source/lib/virtualfilesystem.cpp index 714b89c..ecd145b 100644 --- a/source/lib/virtualfilesystem.cpp +++ b/source/lib/virtualfilesystem.cpp @@ -145,16 +145,27 @@ FileTarget *VirtualFileSystem::find_binary(const string &name) string env_path = Msp::getenv("PATH"); if(!env_path.empty()) { - for(const string &p: split(env_path, ':')) +#ifdef _WIN32 + static constexpr char separator = ';'; +#else + static constexpr char separator = ':'; +#endif + for(const string &p: split(env_path, separator)) sys_bin_path.push_back(p); } else { +#ifdef _WIN32 + sys_bin_path.push_back("C:\\Windows\\System32"); + sys_bin_path.push_back("C:\\Windows"); +#else sys_bin_path.push_back("/bin"); sys_bin_path.push_back("/usr/bin"); +#endif } } path = sys_bin_path; + path.push_back(builder.get_prefix()/"bin"); } for(const FS::Path &p: path)