mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Fix printing wine version with custom WINELOADER
- Don't call bp::search_path when using WINELOADER. It will return an empty string for an absolute path. - To match the behaviour of the exe wrapper scripts, only print the wine version from WINELOADER if the path is executable.
This commit is contained in:
committed by
Robbert van der Helm
parent
0c7dbe8a4a
commit
2aadf5256b
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
#include <boost/dll/runtime_symbol_info.hpp>
|
#include <boost/dll/runtime_symbol_info.hpp>
|
||||||
#include <boost/process/io.hpp>
|
#include <boost/process/io.hpp>
|
||||||
#include <boost/process/pipe.hpp>
|
#include <boost/process/pipe.hpp>
|
||||||
@@ -343,16 +344,17 @@ std::vector<boost::filesystem::path> get_augmented_search_path() {
|
|||||||
std::string get_wine_version() {
|
std::string get_wine_version() {
|
||||||
// The '*.exe' scripts generated by winegcc allow you to override the binary
|
// The '*.exe' scripts generated by winegcc allow you to override the binary
|
||||||
// used to run Wine, so will will respect this as well
|
// 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();
|
bp::environment env = boost::this_process::environment();
|
||||||
if (!env["WINELOADER"].empty()) {
|
const std::string wineloader_path = env["WINELOADER"].to_string();
|
||||||
wine_command = 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;
|
bp::ipstream output;
|
||||||
try {
|
try {
|
||||||
const fs::path wine_path = bp::search_path(wine_command);
|
|
||||||
bp::system(wine_path, "--version", bp::std_out = output);
|
bp::system(wine_path, "--version", bp::std_out = output);
|
||||||
} catch (const std::system_error&) {
|
} catch (const std::system_error&) {
|
||||||
return "<NOT FOUND>";
|
return "<NOT FOUND>";
|
||||||
|
|||||||
Reference in New Issue
Block a user