mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-26 20:25:58 +00:00
Move user.json.txt instead of copy then delete (#25)
This commit is contained in:
parent
f565855b85
commit
8b17f0cfca
1 changed files with 11 additions and 16 deletions
|
@ -68,26 +68,21 @@ bool SlippiUser::AttemptLogin()
|
||||||
INFO_LOG(SLIPPI_ONLINE, "Looking for file at: %s", userFilePath.c_str());
|
INFO_LOG(SLIPPI_ONLINE, "Looking for file at: %s", userFilePath.c_str());
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string userFilePathTxt =
|
// Put the filename here in its own scope because we don't really need it elsewhere
|
||||||
userFilePath + ".txt"; // Put the filename here in its own scope because we don't really need it elsewhere
|
std::string userFilePathTxt = userFilePath + ".txt";
|
||||||
|
if (File::Exists(userFilePathTxt))
|
||||||
|
{
|
||||||
// If both files exist we just log they exist and take no further action
|
// If both files exist we just log they exist and take no further action
|
||||||
if (File::Exists(userFilePathTxt) && File::Exists(userFilePath))
|
if (File::Exists(userFilePath))
|
||||||
{
|
{
|
||||||
INFO_LOG(SLIPPI_ONLINE,
|
INFO_LOG(SLIPPI_ONLINE, "Found both .json.txt and .json file for user data. Using .json "
|
||||||
"Found both .json.txt and .json file for user data. Using .json and ignoring the .json.txt");
|
"and ignoring the .json.txt");
|
||||||
}
|
}
|
||||||
// If only the .txt file exists copy the contents to a json file and delete the text file
|
// If only the .txt file exists move the contents to a json file and log if it fails
|
||||||
else if (File::Exists(userFilePathTxt))
|
else if (!File::Rename(userFilePathTxt, userFilePath))
|
||||||
{
|
{
|
||||||
// Attempt to copy the txt file to the json file path. If it fails log a warning
|
WARN_LOG(SLIPPI_ONLINE, "Could not move file %s to %s", userFilePathTxt.c_str(),
|
||||||
if (!File::Copy(userFilePathTxt, userFilePath))
|
userFilePath.c_str());
|
||||||
{
|
|
||||||
WARN_LOG(SLIPPI_ONLINE, "Could not copy file %s to %s", userFilePathTxt.c_str(), userFilePath.c_str());
|
|
||||||
}
|
|
||||||
// Attempt to delete the txt file. If it fails log an info because this isn't as critical
|
|
||||||
if (!File::Delete(userFilePathTxt))
|
|
||||||
{
|
|
||||||
INFO_LOG(SLIPPI_ONLINE, "Failed to delete %s", userFilePathTxt.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue