From c0cc115545e629383797aa7c6ffa711ca1f30d14 Mon Sep 17 00:00:00 2001 From: Xjph Date: Tue, 26 Oct 2021 19:36:57 -0230 Subject: [PATCH] more reliable fallback for default directory --- ObservatoryCore/LogMonitor.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ObservatoryCore/LogMonitor.cs b/ObservatoryCore/LogMonitor.cs index 661beac..162151c 100644 --- a/ObservatoryCore/LogMonitor.cs +++ b/ObservatoryCore/LogMonitor.cs @@ -213,16 +213,21 @@ namespace Observatory { //throw new DirectoryNotFoundException($"Directory '{path}' does not exist."); //Don't throw, not handling that right now. Just set to current folder. - logDirectory = new DirectoryInfo("."); + logDirectory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); } } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - logDirectory = new DirectoryInfo(GetSavedGamesPath() + @"\Frontier Developments\Elite Dangerous"); + string defaultJournalPath = GetSavedGamesPath() + @"\Frontier Developments\Elite Dangerous"; + + logDirectory = + Directory.Exists(defaultJournalPath) + ? new DirectoryInfo(defaultJournalPath) + : new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - logDirectory = new DirectoryInfo("."); + logDirectory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); } else {