GameCubeConfig: Case insensitive compare & absolute path compare for the part-of-exe-dir check.
This commit is contained in:
parent
583e3fd9e0
commit
c5b81b1aff
|
@ -332,20 +332,24 @@ void GameCubeConfigPane::ChooseSlotPath(bool is_slot_a, TEXIDevices device_type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxFileName newFilename(filename);
|
||||||
|
newFilename.MakeAbsolute();
|
||||||
|
filename = newFilename.GetFullPath();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// If the Memory Card file is within the Exe dir, we can assume that the user wants it to be stored relative
|
// 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.
|
// 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() + '\\';
|
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());
|
filename.erase(0, exeDir.size());
|
||||||
|
|
||||||
std::replace(filename.begin(), filename.end(), '\\', '/');
|
std::replace(filename.begin(), filename.end(), '\\', '/');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// also check that the path isn't used for the other memcard...
|
// also check that the path isn't used for the other memcard...
|
||||||
wxFileName newFilename(filename);
|
|
||||||
wxFileName otherFilename(is_slot_a ? pathB : pathA);
|
wxFileName otherFilename(is_slot_a ? pathB : pathA);
|
||||||
newFilename.MakeAbsolute();
|
|
||||||
otherFilename.MakeAbsolute();
|
otherFilename.MakeAbsolute();
|
||||||
if (newFilename.GetFullPath().compare(otherFilename.GetFullPath()) != 0)
|
if (newFilename.GetFullPath().compare(otherFilename.GetFullPath()) != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue