From 8209b2be469a8da13e16f8bdf10cf48d514463eb Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 26 Nov 2018 14:06:30 +0000 Subject: [PATCH] vulkan json on windows is located adjacent to renderdoc.dll, not exe * This means the json is still located if we're not running this code from qrenderdoc.exe or renderdoccmd.exe --- renderdoc/driver/vulkan/vk_win32.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_win32.cpp b/renderdoc/driver/vulkan/vk_win32.cpp index 16d5fde2b..4a5a16076 100644 --- a/renderdoc/driver/vulkan/vk_win32.cpp +++ b/renderdoc/driver/vulkan/vk_win32.cpp @@ -22,6 +22,7 @@ * THE SOFTWARE. ******************************************************************************/ +#include "strings/string_utils.h" #include "vk_core.h" #include "vk_replay.h" @@ -163,19 +164,16 @@ void *LoadVulkanLibrary() std::wstring GetJSONPath(bool wow6432) { - wchar_t curFile[1024]; - GetModuleFileNameW(NULL, curFile, 1024); - - wchar_t *lastSlash = wcsrchr(curFile, '\\'); - if(lastSlash) - *(lastSlash + 1) = 0; + std::string libPath; + FileIO::GetLibraryFilename(libPath); + std::string jsonPath = dirname(FileIO::GetFullPathname(libPath)); if(wow6432) - wcscat_s(curFile, L"x86\\"); + jsonPath += "\\x86"; - wcscat_s(curFile, L"renderdoc.json"); + jsonPath += "\\renderdoc.json"; - return curFile; + return StringFormat::UTF82Wide(jsonPath); } static HKEY GetImplicitLayersKey(bool writeable, bool wow6432)