@@ -56,30 +56,65 @@ public static List<EventPath> ToPaths(string json)
5656
5757 public static DirectoryInfo GetJournalsDirectory ( )
5858 {
59+ // 1) Explicit override – easiest way to point EliteAPI anywhere you want
60+ var envOverride = Environment . GetEnvironmentVariable ( "ELITE_JOURNAL_DIR" ) ;
61+ if ( ! string . IsNullOrWhiteSpace ( envOverride ) && Directory . Exists ( envOverride ) )
62+ return new DirectoryInfo ( envOverride ) ;
63+
64+ // 2) Linux / macOS – handle Proton path first
65+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ||
66+ RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
67+ {
68+ var home = Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ;
69+
70+ // Proton install path for Elite:
71+ var protonDir = Path . Combine (
72+ home ,
73+ ".local" , "share" , "Steam" , "steamapps" , "compatdata" , "359320" ,
74+ "pfx" , "drive_c" , "users" , "steamuser" ,
75+ "Saved Games" , "Frontier Developments" , "Elite Dangerous" ) ;
76+
77+ if ( Directory . Exists ( protonDir ) )
78+ return new DirectoryInfo ( protonDir ) ;
79+
80+ // Fallback: try native Saved Games layout under $HOME
81+ var savedGames = Path . Combine (
82+ home , "Saved Games" , "Frontier Developments" , "Elite Dangerous" ) ;
83+
84+ if ( Directory . Exists ( savedGames ) )
85+ return new DirectoryInfo ( savedGames ) ;
86+ }
87+
88+ // 3) Windows – original behavior (simplified but equivalent)
5989 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
6090 {
61- // on windows, use registry
6291 var result = SHGetKnownFolderPath (
6392 new Guid ( "4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4" ) ,
6493 0 ,
65- new IntPtr ( 0 ) ,
94+ IntPtr . Zero ,
6695 out var path ) ;
6796
6897 if ( result == 0 && path != IntPtr . Zero )
6998 {
7099 var folderPath = Marshal . PtrToStringUni ( path ) ;
71100 if ( ! string . IsNullOrWhiteSpace ( folderPath ) )
72- return new DirectoryInfo ( Path . Combine ( folderPath , "Frontier Developments" , "Elite Dangerous" ) ) ;
101+ return new DirectoryInfo (
102+ Path . Combine ( folderPath , "Frontier Developments" , "Elite Dangerous" ) ) ;
73103 }
74- }
75104
76- // get through userprofile
77- var userProfile = Environment . GetEnvironmentVariable ( "USERPROFILE" ) ;
78- if ( ! string . IsNullOrWhiteSpace ( userProfile ) )
79- return new DirectoryInfo ( Path . Combine ( userProfile , "Saved Games" , "Frontier Developments" , "Elite Dangerous" ) ) ;
105+ var userProfile = Environment . GetEnvironmentVariable ( "USERPROFILE" ) ;
106+ if ( ! string . IsNullOrWhiteSpace ( userProfile ) )
107+ return new DirectoryInfo (
108+ Path . Combine ( userProfile , "Saved Games" , "Frontier Developments" , "Elite Dangerous" ) ) ;
109+
110+ return new DirectoryInfo (
111+ Path . Combine ( $@ "C:\Users\{ Environment . UserName } \Saved Games\Frontier Developments\Elite Dangerous") ) ;
112+ }
80113
81- // last resort, hardcoded with C:\ drive, hopefully we'll never reach this..
82- return new DirectoryInfo ( Path . Combine ( $@ "C:\Users\{ Environment . UserName } \Saved Games\Frontier Developments\Elite Dangerous") ) ;
114+ // 4) Unknown OS – last resort
115+ var genericHome = Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ;
116+ return new DirectoryInfo (
117+ Path . Combine ( genericHome , "Saved Games" , "Frontier Developments" , "Elite Dangerous" ) ) ;
83118 }
84119
85120 public static void PrepareLocalisations ( string json )
0 commit comments