From 7e350b64baa417274d22e70e5db996423d99d52c Mon Sep 17 00:00:00 2001 From: Kevin Zhang <45326534+taooceros@users.noreply.github.com> Date: Thu, 26 Jan 2023 23:59:19 -0600 Subject: [PATCH] Fix Error of loading backup when original file doesn't exists --- Flow.Launcher.Infrastructure/Storage/JsonStorage.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/Storage/JsonStorage.cs b/Flow.Launcher.Infrastructure/Storage/JsonStorage.cs index 43e7ddab7..3b873524a 100644 --- a/Flow.Launcher.Infrastructure/Storage/JsonStorage.cs +++ b/Flow.Launcher.Infrastructure/Storage/JsonStorage.cs @@ -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; }