From 972cba69ec5e01578fcac0cd44f7f1aedb0ba4bd Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 22 May 2023 02:06:49 +0200 Subject: [PATCH] JsonIgnore And better working directory stuff --- Tranga/TrangaSettings.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Tranga/TrangaSettings.cs b/Tranga/TrangaSettings.cs index c75b705..b0195e6 100644 --- a/Tranga/TrangaSettings.cs +++ b/Tranga/TrangaSettings.cs @@ -6,15 +6,14 @@ public class TrangaSettings { public string downloadLocation { get; set; } public string workingDirectory { get; set; } - public string settingsFilePath => Path.Join(workingDirectory, "settings.json"); - public string tasksFilePath => Path.Join(workingDirectory, "tasks.json"); - public string knownPublicationsPath => Path.Join(workingDirectory, "knownPublications.json"); + [JsonIgnore]public string settingsFilePath => Path.Join(workingDirectory, "settings.json"); + [JsonIgnore]public string tasksFilePath => Path.Join(workingDirectory, "tasks.json"); + [JsonIgnore]public string knownPublicationsPath => Path.Join(workingDirectory, "knownPublications.json"); public Komga? komga { get; set; } - public TrangaSettings(string downloadLocation, string? workingDirectory, Komga? komga) + public TrangaSettings(string downloadLocation, string workingDirectory, Komga? komga) { - this.workingDirectory = workingDirectory ?? - Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Tranga"); + this.workingDirectory = workingDirectory; this.downloadLocation = downloadLocation; this.komga = komga; } @@ -22,7 +21,7 @@ public class TrangaSettings public static TrangaSettings LoadSettings(string importFilePath) { if (!File.Exists(importFilePath)) - return new TrangaSettings(Directory.GetCurrentDirectory(), null, null); + return new TrangaSettings(Path.Join(Directory.GetCurrentDirectory(), "Downloads"), Directory.GetCurrentDirectory(), null); string toRead = File.ReadAllText(importFilePath); TrangaSettings settings = JsonConvert.DeserializeObject(toRead)!;