diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
index 3cb571a..d3cdfca 100644
--- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
+++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
@@ -133,18 +133,39 @@ public partial class MainForm : Form
#region MAIN TAB
///
- /// After the has been loaded, git pull if a repo has been cloned already.
+ /// After the has been loaded, git pull if a repo has been cloned already. Also transfer non-flatpak saves to flatpak
///
private async void PlayButtonLoadComplete(object sender, EventArgs e)
{
- //Only pull if Patchdata is cloned and user wants it updated
LoadProfilesAndAdjustLists();
+ // Transfer saves on flatpak from non-flatpak save to flatpak save
+ if (OS.IsThisRunningFromFlatpak)
+ {
+ string oldHomePath = CrossPlatformOperations.Home;
+ Environment.SetEnvironmentVariable("HOME", $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.DoNotVerify)}/AM2RProfileSaves");
+ string newHomePath = CrossPlatformOperations.Home;
+
+ // TEMPORARY transfer from main saves into Flatpak saves - TODO: remove in about half a year or so
+ // Only do this if the directory for the new saves does not exist yet.
+ foreach (var profile in profileList)
+ {
+ string oldSavePath = profile.SaveLocation.Replace("~", oldHomePath);
+ string newSavePath = profile.SaveLocation.Replace("~", newHomePath);
+
+ if (Directory.Exists(newSavePath)) continue;
+
+ log.Info($"Transfering save data for {profile.Name} from {oldSavePath} to {newSavePath} ...");
+ HelperMethods.DirectoryCopy(oldSavePath, newSavePath);
+ }
+ }
+
+ //Only pull if Patchdata is cloned and user wants it updated
if (!Profile.IsPatchDataCloned() || !autoUpdateAM2RCheck.Checked.Value)
return;
SetPlayButtonState(PlayButtonState.Downloading);
EnableProgressBarAndLabel();
-
+
// Try to pull
try
{
diff --git a/AM2RLauncher/AM2RLauncherLib/CrossPlatformOperations.cs b/AM2RLauncher/AM2RLauncherLib/CrossPlatformOperations.cs
index 4695df7..9873453 100644
--- a/AM2RLauncher/AM2RLauncherLib/CrossPlatformOperations.cs
+++ b/AM2RLauncher/AM2RLauncherLib/CrossPlatformOperations.cs
@@ -25,7 +25,7 @@ public static class CrossPlatformOperations
///
/// Path to the Home Folder.
///
- public static readonly string Home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+ public static string Home => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile, Environment.SpecialFolderOption.Create);
///
/// Config file path for *nix based systems.