Fix crash when first starting the emulator (#945)
* Fix crash when first starting the emulator * Fix a nit
This commit is contained in:
parent
a73fd9e9bd
commit
4789f79254
1 changed files with 8 additions and 4 deletions
|
@ -43,7 +43,8 @@ namespace Ryujinx
|
||||||
DiscordIntegrationModule.Initialize();
|
DiscordIntegrationModule.Initialize();
|
||||||
|
|
||||||
string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json");
|
string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json");
|
||||||
string globalConfigurationPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx", "Config.json");
|
string globalBasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx");
|
||||||
|
string globalConfigurationPath = Path.Combine(globalBasePath, "Config.json");
|
||||||
|
|
||||||
// Now load the configuration as the other subsystems are now registered
|
// Now load the configuration as the other subsystems are now registered
|
||||||
if (File.Exists(localConfigurationPath))
|
if (File.Exists(localConfigurationPath))
|
||||||
|
@ -67,6 +68,9 @@ namespace Ryujinx
|
||||||
// No configuration, we load the default values and save it on disk
|
// No configuration, we load the default values and save it on disk
|
||||||
ConfigurationPath = globalConfigurationPath;
|
ConfigurationPath = globalConfigurationPath;
|
||||||
|
|
||||||
|
// Make sure to create the Ryujinx directory if needed.
|
||||||
|
Directory.CreateDirectory(globalBasePath);
|
||||||
|
|
||||||
ConfigurationState.Instance.LoadDefault();
|
ConfigurationState.Instance.LoadDefault();
|
||||||
ConfigurationState.Instance.ToFileFormat().SaveConfig(globalConfigurationPath);
|
ConfigurationState.Instance.ToFileFormat().SaveConfig(globalConfigurationPath);
|
||||||
}
|
}
|
||||||
|
@ -75,9 +79,9 @@ namespace Ryujinx
|
||||||
|
|
||||||
Application.Init();
|
Application.Init();
|
||||||
|
|
||||||
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx", "system", "prod.keys");
|
string globalProdKeysPath = Path.Combine(globalBasePath, "system", "prod.keys");
|
||||||
string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys");
|
string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys");
|
||||||
if (!File.Exists(appDataPath) && !File.Exists(userProfilePath) && !Migration.IsMigrationNeeded())
|
if (!File.Exists(globalProdKeysPath) && !File.Exists(userProfilePath) && !Migration.IsMigrationNeeded())
|
||||||
{
|
{
|
||||||
GtkDialog.CreateWarningDialog("Key file was not found", "Please refer to `KEYS.md` for more info");
|
GtkDialog.CreateWarningDialog("Key file was not found", "Please refer to `KEYS.md` for more info");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue