|
|
@ -22,10 +22,9 @@ public class SettingsManager : ISettingsManager |
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); |
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); |
|
|
|
private static readonly ReaderWriterLockSlim FileLock = new(); |
|
|
|
private static readonly ReaderWriterLockSlim FileLock = new(); |
|
|
|
|
|
|
|
|
|
|
|
private static readonly string GlobalSettingsPath = Path.Combine( |
|
|
|
private static string GlobalSettingsPath => Path.Combine(Compat.AppDataHome, "global.json"); |
|
|
|
Compat.AppDataHome, |
|
|
|
|
|
|
|
"global.json" |
|
|
|
public string? LibraryDirOverride { private get; set; } |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly string? originalEnvPath = Environment.GetEnvironmentVariable( |
|
|
|
private readonly string? originalEnvPath = Environment.GetEnvironmentVariable( |
|
|
|
"PATH", |
|
|
|
"PATH", |
|
|
@ -274,6 +273,16 @@ public class SettingsManager : ISettingsManager |
|
|
|
if (IsLibraryDirSet && !forceReload) |
|
|
|
if (IsLibraryDirSet && !forceReload) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 0. Check Override |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(LibraryDirOverride)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Logger.Info("Using library override path: {Path}", LibraryDirOverride); |
|
|
|
|
|
|
|
LibraryDir = LibraryDirOverride; |
|
|
|
|
|
|
|
SetStaticLibraryPaths(); |
|
|
|
|
|
|
|
LoadSettings(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 1. Check portable mode |
|
|
|
// 1. Check portable mode |
|
|
|
var appDir = Compat.AppCurrentDir; |
|
|
|
var appDir = Compat.AppCurrentDir; |
|
|
|
IsPortableMode = File.Exists(Path.Combine(appDir, "Data", ".sm-portable")); |
|
|
|
IsPortableMode = File.Exists(Path.Combine(appDir, "Data", ".sm-portable")); |
|
|
|