Skip to content

Commit

Permalink
Merge pull request #143 from yairp03/settings-dir-fix
Browse files Browse the repository at this point in the history
Fix AppSettings directory location empty
  • Loading branch information
yairp03 authored May 8, 2023
2 parents c1de330 + 8946f9e commit f5baf03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions HoradotTV.Console/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ public class AppSettings
{
[JsonIgnore] public static AppSettings Default { get; } = LoadSettings();

public string? LastPath { get; set; }
public string? LastPath { get; set; } = string.Empty;
public Dictionary<string, (string username, string password)> Credentials { get; init; } = new();
public bool ForceDownload { get; set; }

private static AppSettings LoadSettings()
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!,
string path = Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)!,
Constants.SettingsFileName);

if (File.Exists(path))
Expand All @@ -24,7 +24,7 @@ private static AppSettings LoadSettings()

public async Task SaveAsync()
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!,
string path = Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)!,
Constants.SettingsFileName);
await File.WriteAllTextAsync(path,
JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true, IncludeFields = true }));
Expand Down

0 comments on commit f5baf03

Please sign in to comment.