diff options
author | Jan <sentrycraft123@gmail.com> | 2023-10-15 22:18:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-15 22:18:19 +0200 |
commit | f763e66a1ffcb4cd8a06e30ad9de15a4c5139f4b (patch) | |
tree | e7b7f3bc5c8e7c7365f09e92177494a18da70a04 | |
parent | f24089e2d79443962c736ff4651d97e7a97bd952 (diff) | |
download | NorthstarLauncher-f763e66a1ffcb4cd8a06e30ad9de15a4c5139f4b.tar.gz NorthstarLauncher-f763e66a1ffcb4cd8a06e30ad9de15a4c5139f4b.zip |
Fix proton detection output (#534)
Fixes Proton detection logic printing incorrect basename
-rw-r--r-- | NorthstarDLL/logging/logging.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/NorthstarDLL/logging/logging.cpp b/NorthstarDLL/logging/logging.cpp index a68fe704..3416bb8c 100644 --- a/NorthstarDLL/logging/logging.cpp +++ b/NorthstarDLL/logging/logging.cpp @@ -261,12 +261,22 @@ void StartupLog() spdlog::info("Operating System: {} (Wine)", sysname); spdlog::info("Wine build: {}", wine_get_build_id()); + // STEAM_COMPAT_TOOL_PATHS is a colon separated lists of all compat tool paths used + // The first one tends to be the Proton path itself + // We extract the basename out of it to get the name used char* compatToolPtr = std::getenv("STEAM_COMPAT_TOOL_PATHS"); if (compatToolPtr) { - std::string compatToolPath(compatToolPtr); + std::string_view compatToolPath(compatToolPtr); - spdlog::info("Proton build: {}", compatToolPath.substr(compatToolPath.rfind("/") + 1)); + auto protonBasenameEnd = compatToolPath.find(":"); + if (protonBasenameEnd == std::string_view::npos) + protonBasenameEnd = 0; + auto protonBasenameStart = compatToolPath.rfind("/", protonBasenameEnd) + 1; + if (protonBasenameStart == std::string_view::npos) + protonBasenameStart = 0; + + spdlog::info("Proton build: {}", compatToolPath.substr(protonBasenameStart, protonBasenameEnd - protonBasenameStart)); } } else |