diff --git a/MalwareToolbox.DesktopApp/Core/Configurations/JsonConfigProvider.cs b/MalwareToolbox.DesktopApp/Core/Configurations/JsonConfigProvider.cs index c6cc268..661daae 100644 --- a/MalwareToolbox.DesktopApp/Core/Configurations/JsonConfigProvider.cs +++ b/MalwareToolbox.DesktopApp/Core/Configurations/JsonConfigProvider.cs @@ -8,16 +8,18 @@ public class JsonConfigProvider : IConfigProvider { public static readonly string ConfigFileName = "config.json"; + private FileInfo _configFile; private Dictionary _configData; public JsonConfigProvider() { + _configFile = new FileInfo(ConfigFileName); LoadJsonData(); } private void LoadJsonData() { - _configData = File.Exists(ConfigFileName) + _configData = File.Exists(_configFile.FullName) ? JsonConvert.DeserializeObject>(File.ReadAllText("config.json")) : new Dictionary(); } @@ -50,6 +52,6 @@ public void ResetAllConfig() public async void Save() { - await File.WriteAllTextAsync(ConfigFileName, JsonConvert.SerializeObject(_configData)); + await File.WriteAllTextAsync(_configFile.FullName, JsonConvert.SerializeObject(_configData)); } }