22
33using LogExpert . Core . Classes . JsonConverters ;
44using LogExpert . Core . Config ;
5+ using LogExpert . Core . Interface ;
56
67using Newtonsoft . Json ;
78
@@ -47,13 +48,13 @@ public static class Persister
4748 /// <param name="preferences">The user preferences that determine the save location and other settings. This parameter cannot be <see
4849 /// langword="null"/>.</param>
4950 /// <returns>The full path of the file where the persistence data was saved.</returns>
50- public static string SavePersistenceData ( string logFileName , PersistenceData persistenceData , Preferences preferences , string applicationStartupPath )
51+ public static string SavePersistenceData ( string logFileName , PersistenceData persistenceData , Preferences preferences , string sessionBaseDirectory )
5152 {
5253 ArgumentNullException . ThrowIfNull ( preferences ) ;
5354 ArgumentNullException . ThrowIfNull ( persistenceData ) ;
54- ArgumentException . ThrowIfNullOrWhiteSpace ( applicationStartupPath ) ;
55+ ArgumentException . ThrowIfNullOrWhiteSpace ( sessionBaseDirectory ) ;
5556
56- var fileName = persistenceData . SessionFileName ?? BuildPersisterFileName ( logFileName , preferences , applicationStartupPath ) ;
57+ var fileName = persistenceData . SessionFileName ?? BuildPersisterFileName ( logFileName , preferences , sessionBaseDirectory ) ;
5758
5859 if ( preferences . SaveLocation == SessionSaveLocation . SameDir )
5960 {
@@ -84,12 +85,12 @@ public static string SavePersistenceDataWithFixedName (string persistenceFileNam
8485 /// <param name="logFileName">The name of the log file to load persistence data from. This value cannot be null.</param>
8586 /// <param name="preferences">The preferences used to determine the file path and loading behaviour. This value cannot be null.</param>
8687 /// <returns>The loaded <see cref="PersistenceData"/> object containing the persistence information.</returns>
87- public static PersistenceData LoadPersistenceData ( string logFileName , Preferences preferences , string applicationStartupPath )
88+ public static PersistenceData LoadPersistenceData ( string logFileName , Preferences preferences , string sessionBaseDirectory )
8889 {
8990 ArgumentNullException . ThrowIfNull ( preferences ) ;
90- ArgumentNullException . ThrowIfNull ( applicationStartupPath ) ;
91+ ArgumentNullException . ThrowIfNull ( sessionBaseDirectory ) ;
9192
92- var fileName = BuildPersisterFileName ( logFileName , preferences , applicationStartupPath ) ;
93+ var fileName = BuildPersisterFileName ( logFileName , preferences , sessionBaseDirectory ) ;
9394 return LoadInternal ( fileName ) ;
9495 }
9596
@@ -99,12 +100,12 @@ public static PersistenceData LoadPersistenceData (string logFileName, Preferenc
99100 /// <param name="logFileName">The name of the log file used to determine the persistence data file.</param>
100101 /// <param name="preferences">The preferences that influence the file name generation. Cannot be <see langword="null"/>.</param>
101102 /// <returns>A <see cref="PersistenceData"/> object containing the loaded data.</returns>
102- public static PersistenceData LoadPersistenceDataOptionsOnly ( string logFileName , Preferences preferences , string applicationStartupPath )
103+ public static PersistenceData LoadPersistenceDataOptionsOnly ( string logFileName , Preferences preferences , string sessionBaseDirectory )
103104 {
104105 ArgumentNullException . ThrowIfNull ( preferences ) ;
105- ArgumentNullException . ThrowIfNull ( applicationStartupPath ) ;
106+ ArgumentNullException . ThrowIfNull ( sessionBaseDirectory ) ;
106107
107- var fileName = BuildPersisterFileName ( logFileName , preferences , applicationStartupPath ) ;
108+ var fileName = BuildPersisterFileName ( logFileName , preferences , sessionBaseDirectory ) ;
108109 return LoadInternal ( fileName ) ;
109110 }
110111
@@ -138,6 +139,7 @@ public static PersistenceData LoadPersistenceDataFromFixedFile (string persisten
138139 /// <returns>A <see cref="PersistenceData"/> object representing the data loaded from the file.</returns>
139140 public static PersistenceData Load ( string fileName )
140141 {
142+ //Dont Call ActiveConfigDir here
141143 return LoadInternal ( fileName ) ;
142144 }
143145
@@ -155,7 +157,7 @@ public static PersistenceData Load (string fileName)
155157 /// <param name="preferences">The preferences that determine the save location and directory structure for the persister file.</param>
156158 /// <returns>The full file path of the persister file, including the directory and file name, based on the specified log file
157159 /// name and preferences.</returns>
158- private static string BuildPersisterFileName ( string logFileName , Preferences preferences , string applicationStartupPath )
160+ private static string BuildPersisterFileName ( string logFileName , Preferences preferences , string sessionBaseDirectory )
159161 {
160162 string dir ;
161163 string file ;
@@ -186,7 +188,7 @@ private static string BuildPersisterFileName (string logFileName, Preferences pr
186188 }
187189 case SessionSaveLocation . ApplicationStartupDir :
188190 {
189- dir = Path . Join ( applicationStartupPath , "sessionFiles" ) ;
191+ dir = sessionBaseDirectory ;
190192 file = dir + Path . DirectorySeparatorChar + BuildSessionFileNameFromPath ( logFileName ) ;
191193 break ;
192194 }
0 commit comments