diff --git a/Elite/History.cs b/Elite/History.cs index 3b825a0..85c583e 100644 --- a/Elite/History.cs +++ b/Elite/History.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; +using System.Configuration; using System.Drawing; using System.Globalization; using System.IO; @@ -84,6 +86,11 @@ public static extern int SHGetKnownFolderPath([MarshalAs(UnmanagedType.LPStruct) IntPtr hToken, out IntPtr ppszPath); } + private static string GetExePath() + { + var strExeFilePath = System.Reflection.Assembly.GetExecutingAssembly().Location; + return Path.GetDirectoryName(strExeFilePath); + } /// /// The standard Directory of the Player Journal files (C:\Users\%username%\Saved Games\Frontier Developments\Elite Dangerous). @@ -92,6 +99,18 @@ private static DirectoryInfo StandardDirectory { get { + var exePath = GetExePath(); + + if (File.Exists(Path.Combine(exePath, "appSettings.config")) && + ConfigurationManager.GetSection("appSettings") is NameValueCollection appSection) + { + var journalPath = appSection["JournalPath"]; + if (!string.IsNullOrEmpty(journalPath)) + { + return new DirectoryInfo(journalPath); + } + } + //#if DEBUG //return new DirectoryInfo(@"C:\Users\Marcel\Desktop\Elite Dangerous"); //#endif diff --git a/Elite/appsettings.config b/Elite/appsettings.config index d3a1513..d80a559 100644 --- a/Elite/appsettings.config +++ b/Elite/appsettings.config @@ -1,5 +1,6 @@ - + + \ No newline at end of file