From e727570faea5f2940f5ee4e34eec0b0a719b434c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 19 Sep 2022 08:30:57 -0700 Subject: [PATCH] Windows: Normalize paths for OpenDirectory(). This was making GE frame dumps not automatically browse when run from MSVC debugging by default, because of the relative path. --- Windows/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Windows/main.cpp b/Windows/main.cpp index 4c0752bda8..e3888dfe4c 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -34,6 +34,7 @@ #include "Common/System/Display.h" #include "Common/System/NativeApp.h" #include "Common/System/System.h" +#include "Common/File/FileUtil.h" #include "Common/File/VFS/VFS.h" #include "Common/File/VFS/AssetReader.h" #include "Common/Data/Text/I18n.h" @@ -109,9 +110,12 @@ static std::thread inputBoxThread; static bool inputBoxRunning = false; void OpenDirectory(const char *path) { + // SHParseDisplayName can't handle relative paths, so normalize first. + std::string resolved = ReplaceAll(File::ResolvePath(path), "/", "\\"); + SFGAOF flags; PIDLIST_ABSOLUTE pidl = nullptr; - HRESULT hr = SHParseDisplayName(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str(), nullptr, &pidl, 0, &flags); + HRESULT hr = SHParseDisplayName(ConvertUTF8ToWString(resolved).c_str(), nullptr, &pidl, 0, &flags); if (pidl) { if (SUCCEEDED(hr))