diff --git a/src/plugin/utils.cpp b/src/plugin/utils.cpp index 7f65f393..7735f1c3 100644 --- a/src/plugin/utils.cpp +++ b/src/plugin/utils.cpp @@ -16,6 +16,7 @@ #include "utils.h" +#include #include #include #include @@ -343,16 +344,17 @@ std::vector get_augmented_search_path() { std::string get_wine_version() { // The '*.exe' scripts generated by winegcc allow you to override the binary // used to run Wine, so will will respect this as well - std::string wine_command = "wine"; - + std::string wine_path; bp::environment env = boost::this_process::environment(); - if (!env["WINELOADER"].empty()) { - wine_command = env["WINELOADER"].to_string(); + const std::string wineloader_path = env["WINELOADER"].to_string(); + if (access(wineloader_path.c_str(), X_OK) == 0) { + wine_path = wineloader_path; + } else { + wine_path = bp::search_path("wine"); } bp::ipstream output; try { - const fs::path wine_path = bp::search_path(wine_command); bp::system(wine_path, "--version", bp::std_out = output); } catch (const std::system_error&) { return "";