Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ChooseMemcardPath bugfix: check for a directory separator before conv…
…erting 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
  • Loading branch information
LPFaint99 committed Oct 4, 2013
1 parent fe3d0c9 commit 8c103a8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Source/Core/DolphinWX/Src/ConfigMain.cpp
Expand Up @@ -1076,8 +1076,14 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
#ifdef _WIN32
if (!strncmp(File::GetExeDirectory().c_str(), filename.c_str(), File::GetExeDirectory().size()))
{
filename.erase(0, File::GetExeDirectory().size() +1);
filename = "./" + filename;
// If the Exe Directory Matches the prefix of the filename, we still need to verify
// 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

Expand Down

0 comments on commit 8c103a8

Please sign in to comment.