From bd6c1c20115d6cfc777e0cb28ac26f8fc62c0aca Mon Sep 17 00:00:00 2001 From: Miepee Date: Sun, 11 Dec 2022 12:19:47 +0100 Subject: [PATCH] Fix windows crash trying to assign custom save location --- AM2RModPacker/ModPacker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AM2RModPacker/ModPacker.cs b/AM2RModPacker/ModPacker.cs index abf2b91..0c8fa5c 100644 --- a/AM2RModPacker/ModPacker.cs +++ b/AM2RModPacker/ModPacker.cs @@ -30,9 +30,9 @@ public partial class ModPacker : Form private void CustomSaveDataButton_Click(object sender, EventArgs e) { - string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile).Replace("\\", "\\\\"); // This is \ -> \\ bool wasSuccessful = false; - var winSaveRegex = new Regex(@"C:\\Users\\.*\\AppData\\Local\\"); //this is to ensure, that the save directory is valid. so far, this is only important for windows + var winSaveRegex = new Regex(@"C:\\Users\\.*\\AppData\\Local\\"); //this is to ensure, that the save directory is valid. so far, this is only important for windows var linSaveRegex = new Regex($@"{home}/\.config/"); // GMS hardcodes save into ~/.config on linux var macSaveRegex = new Regex($@"{home}/Library/Application Support/");