summaryrefslogtreecommitdiff
path: root/app-emulation/86BoxManagerX/files/86BoxManagerX-9999-save-config-user-directory.patch
blob: 674fea9a1e64e643ad8e8e26270594005563e057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff --git a/86BoxManager.Core/Registry/Configs.cs b/86BoxManager.Core/Registry/Configs.cs
index c61e99a..be25067 100644
--- a/86BoxManager.Core/Registry/Configs.cs
+++ b/86BoxManager.Core/Registry/Configs.cs
@@ -1,3 +1,4 @@
+using System;
 using System.IO;
 using System.Text;
 using Newtonsoft.Json;
@@ -18,11 +19,13 @@ static Configs()
             {
                 Formatting = Formatting.Indented
             };
-            var ass = typeof(Configs).Assembly;
-            var loc = IOPath.GetFullPath(ass.Location);
-            var dir = IOPath.GetDirectoryName(loc) ?? string.Empty;
-            BoxConfigName = IOPath.Combine(dir, "86Box.json");
-            VmxConfigName = IOPath.Combine(dir, "86BoxVMs.json");
+
+            var userConfigDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create);
+            var appConfigDir = IOPath.Combine(userConfigDir, "86BoxManager");
+            if (!Directory.Exists(appConfigDir)) Directory.CreateDirectory(appConfigDir);
+
+            BoxConfigName = IOPath.Combine(appConfigDir, "86Box.json");
+            VmxConfigName = IOPath.Combine(appConfigDir, "86BoxVMs.json");
         }
 
         private static void WriteJson(string fileName, object obj)