Fix Error of loading backup when original file doesn't exists

This commit is contained in:
Kevin Zhang 2023-01-26 23:59:19 -06:00 committed by GitHub
parent 7fc704558d
commit 7e350b64ba
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.Copy(BackupFilePath, FilePath);
return data;
}