aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThog <me@thog.eu>2020-02-14 23:07:22 +0100
committerGitHub <noreply@github.com>2020-02-14 23:07:22 +0100
commit4789f79254aea21740e8bf96d1b129a748bdd002 (patch)
tree586cf60f2a5b0d6c6557bc65bad3a3d0c7cd0946
parenta73fd9e9bdb18d198cbfaf45108aec23db78db71 (diff)
Fix crash when first starting the emulator (#945)
* Fix crash when first starting the emulator * Fix a nit
-rw-r--r--Ryujinx/Program.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs
index 1f417f5a..7ff2b64f 100644
--- a/Ryujinx/Program.cs
+++ b/Ryujinx/Program.cs
@@ -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 userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys");
- if (!File.Exists(appDataPath) && !File.Exists(userProfilePath) && !Migration.IsMigrationNeeded())
+ string globalProdKeysPath = Path.Combine(globalBasePath, "system", "prod.keys");
+ string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys");
+ if (!File.Exists(globalProdKeysPath) && !File.Exists(userProfilePath) && !Migration.IsMigrationNeeded())
{
GtkDialog.CreateWarningDialog("Key file was not found", "Please refer to `KEYS.md` for more info");
}