2
0

Fix new installation startup issue where version would be null on new installs

This commit is contained in:
glax 2023-07-31 22:47:35 +02:00
parent 53fe7ee983
commit a63154b581
2 changed files with 6 additions and 2 deletions

View File

@ -9,7 +9,7 @@ namespace Tranga;
public static class Migrator public static class Migrator
{ {
private static readonly ushort CurrentVersion = 17; internal static readonly ushort CurrentVersion = 17;
public static void Migrate(string settingsFilePath, Logger? logger) public static void Migrate(string settingsFilePath, Logger? logger)
{ {
if (!File.Exists(settingsFilePath)) if (!File.Exists(settingsFilePath))

View File

@ -38,8 +38,12 @@ public static class Tranga
{ {
logger.WriteLine("Tranga", $"Loading settings {settingsFilePath}"); logger.WriteLine("Tranga", $"Loading settings {settingsFilePath}");
settings = TrangaSettings.LoadSettings(settingsFilePath); settings = TrangaSettings.LoadSettings(settingsFilePath);
}else }
else
{
settings = new TrangaSettings(downloadFolderPath, applicationFolderPath); settings = new TrangaSettings(downloadFolderPath, applicationFolderPath);
settings.version = Migrator.CurrentVersion;
}
Directory.CreateDirectory(settings.workingDirectory); Directory.CreateDirectory(settings.workingDirectory);
Directory.CreateDirectory(settings.downloadLocation); Directory.CreateDirectory(settings.downloadLocation);