ChooseMemcardPath bugfix: check for a directory separator before converting an absolute path to a relative path.
if the exe directory and the save directory had the same prefix, .../dolphin emulator/... and .../dolphin/... the path would previously have been incorrectly changed
This commit is contained in:
parent
fe3d0c9aa2
commit
8c103a8dee
|
@ -1076,8 +1076,14 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!strncmp(File::GetExeDirectory().c_str(), filename.c_str(), File::GetExeDirectory().size()))
|
if (!strncmp(File::GetExeDirectory().c_str(), filename.c_str(), File::GetExeDirectory().size()))
|
||||||
{
|
{
|
||||||
filename.erase(0, File::GetExeDirectory().size() +1);
|
// If the Exe Directory Matches the prefix of the filename, we still need to verify
|
||||||
filename = "./" + filename;
|
// that the next character is a directory separator character, otherwise we may create an invalid path
|
||||||
|
char next_char = filename.at(File::GetExeDirectory().size())+1;
|
||||||
|
if (next_char == '/' || next_char == '\\')
|
||||||
|
{
|
||||||
|
filename.erase(0, File::GetExeDirectory().size() +1);
|
||||||
|
filename = "./" + filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue