From 6b6911ae544bc817e38e5058988e4cc3854224f5 Mon Sep 17 00:00:00 2001 From: Miepee Date: Sun, 16 Apr 2023 20:24:47 +0200 Subject: [PATCH] Try to fix a flatpak home weirdness --- AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs index b9147ae..bf51156 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs @@ -143,6 +143,11 @@ public partial class MainForm : Form { log.Info("Checking whether to transfer Flatpak saves..."); string oldHomePath = CrossPlatformOperations.Home; + // One can always set environment variables to other environment variables, and dotnet doesn't expand these by default + // However, since only Flatpak is majorly affected by this, I only do this workaround for there + if (oldHomePath == "$XDG_DATA_HOME") + oldHomePath = Environment.GetEnvironmentVariable("XDG_DATA_HOME"); + log.Info("Old home path is " + oldHomePath); Environment.SetEnvironmentVariable("HOME", $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.DoNotVerify)}/AM2RProfileSaves"); string newHomePath = CrossPlatformOperations.Home;