summarylogtreecommitdiffstats
path: root/discord-chat-exporter_xdg_settings.patch
blob: 6eef9981f316bcf17f2b70dc255fe7d3fa2cade8 (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
--- a/DiscordChatExporter.Gui/Services/SettingsService.cs
+++ b/DiscordChatExporter.Gui/Services/SettingsService.cs
@@ -13,10 +13,21 @@
 [ObservableObject]
 public partial class SettingsService()
     : SettingsBase(
-        Path.Combine(AppContext.BaseDirectory, "Settings.dat"),
+        GetSettingsPath(),
         SerializerContext.Default
     )
 {
+    private static string GetSettingsPath()
+    {
+        var configDir = Environment.GetEnvironmentVariable("XDG_CONFIG_HOME");
+        if (string.IsNullOrEmpty(configDir))
+            configDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config");
+        
+        configDir = Path.Combine(configDir, "DiscordChatExporter");
+        Directory.CreateDirectory(configDir);
+        return Path.Combine(configDir, "Settings.dat");
+    }
+
     [ObservableProperty]
     public partial bool IsUkraineSupportMessageEnabled { get; set; } = true;