Don't filter out empty environment variables

This check was only needed because `operator[]` inserts an empty entry
if the variable doesn't exist. Wine also complains when `WINEPREFIX` is
empty, so we should probably not try to have our own behavior here.
This commit is contained in:
Robbert van der Helm
2021-10-17 16:15:48 +02:00
parent 1eaee22bb9
commit 9aca27a192
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -42,10 +42,10 @@ constexpr char temp_dir_override_env_var[] = "YABRIDGE_TEMP_DIR";
fs::path get_temporary_directory() {
const bp::environment env = boost::this_process::environment();
if (const auto directory = env.find(temp_dir_override_env_var);
directory != env.end() && !directory->empty()) {
directory != env.end()) {
return directory->to_string();
} else if (const auto directory = env.find("XDG_RUNTIME_DIR");
directory != env.end() && !directory->empty()) {
directory != env.end()) {
return directory->to_string();
} else {
return fs::temp_directory_path();
+1 -2
View File
@@ -257,8 +257,7 @@ fs::path normalize_plugin_path(const fs::path& windows_library_path,
std::variant<OverridenWinePrefix, fs::path, DefaultWinePrefix> find_wine_prefix(
fs::path windows_plugin_path) {
const bp::environment env = boost::this_process::environment();
if (const auto prefix = env.find("WINEPREFIX");
prefix != env.end() && !prefix->empty()) {
if (const auto prefix = env.find("WINEPREFIX"); prefix != env.end()) {
return OverridenWinePrefix{prefix->to_string()};
}