From c5b81b1aff9d9f34bac41da71ae02905fe4ee913 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Sat, 27 Jun 2015 18:34:54 +0200 Subject: [PATCH] GameCubeConfig: Case insensitive compare & absolute path compare for the part-of-exe-dir check. --- Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp b/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp index 807015427c..f4426ef3a9 100644 --- a/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp @@ -332,20 +332,24 @@ void GameCubeConfigPane::ChooseSlotPath(bool is_slot_a, TEXIDevices device_type) } } } + + wxFileName newFilename(filename); + newFilename.MakeAbsolute(); + filename = newFilename.GetFullPath(); + #ifdef _WIN32 // If the Memory Card file is within the Exe dir, we can assume that the user wants it to be stored relative // to the executable, so it stays set correctly when the probably portable Exe dir is moved. + // TODO: Replace this with a cleaner, non-wx solution once std::filesystem is standard std::string exeDir = File::GetExeDirectory() + '\\'; - if (!strncmp(exeDir.c_str(), filename.c_str(), exeDir.size())) + if (wxString(filename).Lower().StartsWith(wxString(exeDir).Lower())) filename.erase(0, exeDir.size()); std::replace(filename.begin(), filename.end(), '\\', '/'); #endif // also check that the path isn't used for the other memcard... - wxFileName newFilename(filename); wxFileName otherFilename(is_slot_a ? pathB : pathA); - newFilename.MakeAbsolute(); otherFilename.MakeAbsolute(); if (newFilename.GetFullPath().compare(otherFilename.GetFullPath()) != 0) {