diff --git a/balatro-mobile-maker/Platform.cs b/balatro-mobile-maker/Platform.cs index 8a835b2..ec9da52 100644 --- a/balatro-mobile-maker/Platform.cs +++ b/balatro-mobile-maker/Platform.cs @@ -132,6 +132,22 @@ public static string getGameSaveLocation() return "."; } + public static string getModLocation() + { + if (isWindows) + return Environment.GetEnvironmentVariable("AppData") + "\\BalatroBACKUP\\Mods"; + + //TODO: Test Linux location + if (isLinux) + return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/.local/share/Steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/BalatroBACKUP/Mods"; + + //TODO: Implement + if (isOSX) + return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/Library/Application Support/Balatro"; // unchanged, I don't know anything about OSX filestructure and I'd probably break smth + + return "."; + } + //Checks whether the game already exists in the directory //If it does not exist, it attempts to grab it from the default location //If it does already exist, this returns true diff --git a/balatro-mobile-maker/View.cs b/balatro-mobile-maker/View.cs index 5c6e258..b8a98e6 100644 --- a/balatro-mobile-maker/View.cs +++ b/balatro-mobile-maker/View.cs @@ -33,6 +33,9 @@ public void Begin() _cleaup = AskQuestion("Would you like to automatically clean up once complete?"); _verboseMode = AskQuestion("Would you like to enable extra logging information?"); + //Checks if the game executable was already present in the directory + gameProvided = Platform.gameExists(); + //If balatro.apk or balatro.ipa already exists, ask before beginning build process again if (!(fileExists("balatro.apk") || fileExists("balatro.ipa")) || AskQuestion("A previous build was found... Would you like to build again?")) { @@ -87,8 +90,6 @@ public void Begin() #region Prepare workspace #region Find and extract Balatro.exe - gameProvided = Platform.gameExists(); - if (gameProvided) Log("Game found!"); else @@ -304,12 +305,16 @@ public void Begin() PrepareAndroidPlatformTools(); Log("Backing up your files..."); + if (!directoryExists(Platform.getGameSaveLocation() + "BACKUP")) System.IO.Directory.CreateDirectory(Platform.getGameSaveLocation() + "BACKUP/"); //TODO: No xcopy RunCommand("xcopy", "\"" + Platform.getGameSaveLocation() + "\" \"" + Platform.getGameSaveLocation() + "BACKUP\\\" /E /H /Y /V"); + tryDelete(Platform.getGameSaveLocation()); System.IO.Directory.CreateDirectory(Platform.getGameSaveLocation()); + + Log("Attempting to pull save files from Android device."); @@ -343,6 +348,12 @@ public void Begin() useTool(ProcessTools.ADB, "shell find /data/local/tmp/balatro/files/ -maxdepth 2 -size 0c -exec rm '{}' \\;"); useTool(ProcessTools.ADB, "pull /data/local/tmp/balatro/files/. \"" + Platform.getGameSaveLocation() + "\""); + if (directoryExists(Platform.getModLocation())) { // only want this to run if the mods folder exists in the first place + Log("Restoring mods folder..."); + System.IO.Directory.CreateDirectory(Platform.getGameSaveLocation() + "\\Mods"); + RunCommand("xcopy", Platform.getModLocation() + " " + Platform.getGameSaveLocation() + "\\Mods" + " /E /H /Y /V"); // iinob: I know it says no xcopy up there, but I don't use dotnet very often and idk any other way to do it + } + useTool(ProcessTools.ADB, "kill-server"); } }