Skip to content

Commit 7e350b6

Browse files
authored
Fix Error of loading backup when original file doesn't exists
1 parent 7fc7045 commit 7e350b6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Flow.Launcher.Infrastructure/Storage/JsonStorage.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ private T LoadDefault()
7777
if (data != null)
7878
{
7979
Log.Info($"|JsonStorage.Load|Failed to load settings.json, {BackupFilePath} restored successfully");
80-
File.Replace(BackupFilePath, FilePath, null);
80+
81+
if(File.Exists(FilePath)
82+
File.Replace(BackupFilePath, FilePath, null);
83+
else
84+
File.Copy(BackupFilePath, FilePath);
8185

8286
return data;
8387
}

0 commit comments

Comments
 (0)