From 6098a8bcef5508aabf9171108c9a10965e5f8d13 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 4 Sep 2023 02:16:56 +0300 Subject: [PATCH] Fix processing of PATH on Windows Also always add the bin directory of the install prefix. --- source/lib/virtualfilesystem.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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) -- 2.45.2