Update Program.cs
This commit is contained in:
parent
e730f144a2
commit
a32d9d5b55
@ -155,14 +155,18 @@ namespace Ryujinx.Ava
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReloadConfig()
|
||||
{
|
||||
public static void ReloadConfig()
|
||||
{
|
||||
|
||||
string OverrideConfigurationPath = "";
|
||||
string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ReleaseInformation.ConfigName);
|
||||
string appDataConfigurationPath = Path.Combine(AppDataManager.BaseDirPath, ReleaseInformation.ConfigName);
|
||||
|
||||
|
||||
string overrideLocalConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ReleaseInformation.CustomConfigNameOverride);
|
||||
string overrideAppDataConfigurationPath = Path.Combine(AppDataManager.BaseDirPath, ReleaseInformation.CustomConfigNameOverride);
|
||||
|
||||
|
||||
|
||||
|
||||
// Now load the configuration as the other subsystems are now registered
|
||||
if (File.Exists(localConfigurationPath))
|
||||
{
|
||||
@ -174,13 +178,13 @@ namespace Ryujinx.Ava
|
||||
ConfigurationPath = appDataConfigurationPath;
|
||||
OverrideConfigurationPath = overrideAppDataConfigurationPath;
|
||||
}
|
||||
|
||||
|
||||
if (ConfigurationPath == null)
|
||||
{
|
||||
// No configuration, we load the default values and save it to disk
|
||||
ConfigurationPath = appDataConfigurationPath;
|
||||
Logger.Notice.Print(LogClass.Application, $"No configuration file found. Saving default configuration to: {ConfigurationPath}");
|
||||
|
||||
|
||||
ConfigurationState.Instance.LoadDefault();
|
||||
ConfigurationState.Instance.ToFileFormat().SaveConfig(ConfigurationPath);
|
||||
ConfigurationState.Instance.ToFileFormat().SaveConfig(OverrideConfigurationPath);
|
||||
@ -188,7 +192,7 @@ namespace Ryujinx.Ava
|
||||
else
|
||||
{
|
||||
Logger.Notice.Print(LogClass.Application, $"Loading configuration from: {ConfigurationPath}");
|
||||
|
||||
|
||||
if (ConfigurationFileFormat.TryLoad(ConfigurationPath, out ConfigurationFileFormat configurationFileFormat))
|
||||
{
|
||||
ConfigurationState.Instance.Load(configurationFileFormat, ConfigurationPath);
|
||||
@ -197,11 +201,11 @@ namespace Ryujinx.Ava
|
||||
else
|
||||
{
|
||||
Logger.Warning?.PrintMsg(LogClass.Application, $"Failed to load config! Loading the default config instead.\nFailed config location: {ConfigurationPath}");
|
||||
|
||||
|
||||
ConfigurationState.Instance.LoadDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Copies and reloads the configuration file if the game was loaded with arguments
|
||||
// based on global configuration
|
||||
if (CommandLineState.CountArguments > 0)
|
||||
@ -210,13 +214,13 @@ namespace Ryujinx.Ava
|
||||
{
|
||||
ConfigurationPath = overrideLocalConfigurationPath;
|
||||
Logger.Notice.Print(LogClass.Application, $"(args)Loading configuration (Local) from: {ConfigurationPath}");
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Notice.Print(LogClass.Application, $"File not found(Local): {overrideLocalConfigurationPath}");
|
||||
}
|
||||
|
||||
|
||||
if (File.Exists(overrideAppDataConfigurationPath))
|
||||
{
|
||||
ConfigurationPath = overrideAppDataConfigurationPath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user