Fix crash when first starting the emulator (#945)

* Fix crash when first starting the emulator

* Fix a nit
This commit is contained in:
Thog 2020-02-14 23:07:22 +01:00 committed by GitHub
parent a73fd9e9bd
commit 4789f79254
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,7 +43,8 @@ namespace Ryujinx
DiscordIntegrationModule.Initialize();
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
if (File.Exists(localConfigurationPath))
@ -67,6 +68,9 @@ namespace Ryujinx
// No configuration, we load the default values and save it on disk
ConfigurationPath = globalConfigurationPath;
// Make sure to create the Ryujinx directory if needed.
Directory.CreateDirectory(globalBasePath);
ConfigurationState.Instance.LoadDefault();
ConfigurationState.Instance.ToFileFormat().SaveConfig(globalConfigurationPath);
}
@ -75,9 +79,9 @@ namespace Ryujinx
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");
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");
}