From be5421f139255bfd0fb5fe15f52dd7e436c0f866 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 12 Jan 2026 20:42:28 +0100 Subject: [PATCH] Windows: fix user directory opening in the wrong place (#16842) --- src/porting.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/porting.cpp b/src/porting.cpp index 5398f5063e..cf48390471 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -887,6 +887,7 @@ static bool open_uri(const std::string &uri) errorstream << "Unable to open URI as it is invalid, contains new line: " << uri << std::endl; return false; } + verbosestream << "Opening URI: " << uri << std::endl; #if defined(_WIN32) return (intptr_t)ShellExecuteA(NULL, NULL, uri.c_str(), NULL, NULL, SW_SHOWNORMAL) > 32; @@ -920,7 +921,11 @@ bool open_directory(const std::string &path) return false; } - return open_uri(path); + // 'fs::AbsolutePath' is a workaround for Windows (10, ... ?) where the relative part of the path + // such as in "bin\.." is discarded by 'ShellExecuteA'. Hence, resolve it manually. + // This is done on all platforms because why not. + + return open_uri(fs::AbsolutePath(path)); } // Load performance counter frequency only once at startup