Merge pull request #1854 from Flow-Launcher/taooceros-patch-1

Fix Error of loading backup when original file doesn't exists
This commit is contained in:
Jeremy Wu 2023-02-06 13:39:20 +11:00 committed by GitHub
commit d40ff120e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,7 +77,11 @@ namespace Flow.Launcher.Infrastructure.Storage
if (data != null)
{
Log.Info($"|JsonStorage.Load|Failed to load settings.json, {BackupFilePath} restored successfully");
File.Replace(BackupFilePath, FilePath, null);
if(File.Exists(FilePath))
File.Replace(BackupFilePath, FilePath, null);
else
File.Move(BackupFilePath, FilePath);
return data;
}