summary refs log tree commit diff
path: root/SpacebarDiscordDesktopLauncher/Program.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-02-02 19:34:40 +0100
committerRory& <root@rory.gay>2026-02-02 19:34:40 +0100
commit1aaab43acdeb09c1c73999640f91d07bada1742f (patch)
treeb6ec7f967f09bb68b6768b4eeb2a2dc4dc7dfe3a /SpacebarDiscordDesktopLauncher/Program.cs
parentBump to .net 10 (diff)
downloadSpacebarDiscordDesktopLauncher-1aaab43acdeb09c1c73999640f91d07bada1742f.tar.xz
Create target dir if not exists
Diffstat (limited to 'SpacebarDiscordDesktopLauncher/Program.cs')
-rw-r--r--SpacebarDiscordDesktopLauncher/Program.cs30
1 files changed, 21 insertions, 9 deletions
diff --git a/SpacebarDiscordDesktopLauncher/Program.cs b/SpacebarDiscordDesktopLauncher/Program.cs

index 9ab2af0..3ef8e00 100644 --- a/SpacebarDiscordDesktopLauncher/Program.cs +++ b/SpacebarDiscordDesktopLauncher/Program.cs
@@ -9,19 +9,21 @@ internal class Program { public static void Main(string[] args) { - string? discordClientPath = Environment.OSVersion.Platform switch + var discordClientPath = Environment.OSVersion.Platform switch { PlatformID.Win32NT => WindowsDiscordClientFinder.FindDiscord(), PlatformID.Unix => LinuxDiscordClientFinder.FindDiscord(), _ => throw new Exception($"Unknown platform: {Environment.OSVersion.Platform}") }; + var discordBinName = Path.GetFileNameWithoutExtension(discordClientPath).ToLower(); - string? userDataPath = Environment.OSVersion.Platform switch + var userDataPath = Environment.OSVersion.Platform switch { PlatformID.Win32NT => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share", "Discord-SpacebarLauncher"), - PlatformID.Unix => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", + PlatformID.Unix => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + ".local", "share", "Discord-SpacebarLauncher"), _ => throw new Exception($"Unknown platform: {Environment.OSVersion.Platform}") @@ -34,29 +36,35 @@ internal class Program return; } + if (!Directory.Exists(Path.Combine(userDataPath, discordBinName))) + Directory.CreateDirectory(Path.Combine(userDataPath, discordBinName)); + if (Environment.OSVersion.Platform == PlatformID.Unix) { - var settingsJsonPath = Path.Combine(userDataPath, "discord", "settings.json"); + var settingsJsonPath = Path.Combine(userDataPath, discordBinName, "settings.json"); JsonObject discordSettings = new(); if (File.Exists(settingsJsonPath)) discordSettings = JsonSerializer.Deserialize<JsonObject>(File.ReadAllText(settingsJsonPath)); // skip updates discordSettings!["SKIP_HOST_UPDATE"] = true; - discordSettings!["SKIP_MODULE_UPDATE"] = true; + // discordSettings!["SKIP_MODULE_UPDATE"] = true; //discordSettings!["ALWAYS_ALLOW_UPDATES"] = false; - //discordSettings!["ALWAYS_BOOTSTRAP_MODULES"] = false; - discordSettings!["USE_LOCAL_MODULE_VERSIONS"] = true; + discordSettings!["ALWAYS_BOOTSTRAP_MODULES"] = false; + // discordSettings!["USE_LOCAL_MODULE_VERSIONS"] = true; // enable devtools discordSettings!["DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING"] = true; // various behavior changes - discordSettings!["WEBAPP_ENDPOINT"] = "https://dev.app.spacebar.chat"; + //discordSettings!["WEBAPP_ENDPOINT"] = "https://discord.localhost"; + //discordSettings!["WEBAPP_ENDPOINT"] = "https://localhost:2001"; + //discordSettings!["WEBAPP_ENDPOINT"] = "http://localhost:2000"; + discordSettings!["WEBAPP_ENDPOINT"] = "https://fermi.chat"; discordSettings!["trayBalloonShown"] = true; // We don't need to be re-introduced to how system trays work discordSettings!["MIN_WIDTH"] = 1; discordSettings!["MIN_HEIGHT"] = 1; - discordSettings!["BACKGROUND_COLOR"] = "#0000FF"; + discordSettings!["BACKGROUND_COLOR"] = "#000011"; File.WriteAllText(settingsJsonPath, JsonSerializer.Serialize(discordSettings)); @@ -70,6 +78,10 @@ internal class Program { // { "DISCORD_WEBAPP_ENDPOINT", "http://discord.localhost" }, { "DISCORD_USER_DATA_DIR", userDataPath }, + { "ELECTRON_ENABLE_STACK_DUMPING", "true" }, // disables hardcoded crash reporter, as initialised by Discord + + { "ELECTRON_OZONE_PLATFORM_HINT", "auto" }, // enable wayland support + } };