From 0295b4c204880a2f2f6a922c02ec4355bbbe897d Mon Sep 17 00:00:00 2001 From: Miepee Date: Mon, 7 Nov 2022 14:38:13 +0100 Subject: [PATCH] Circumvent apktool default path Apktool is hardcoded for linux to choose ~/.local/share (https://github.com/iBotPeaches/Apktool/blob/f8df056a2c6707b95348313ab71098858d3e3a10/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java#L977) Since this will crash in flatpak situations (and others) we thus cirvument this by specifying out custom framework path --- AM2RLauncher/AM2RLauncherLib/Profile.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/AM2RLauncher/AM2RLauncherLib/Profile.cs b/AM2RLauncher/AM2RLauncherLib/Profile.cs index 3c35859..32c43fd 100644 --- a/AM2RLauncher/AM2RLauncherLib/Profile.cs +++ b/AM2RLauncher/AM2RLauncherLib/Profile.cs @@ -446,7 +446,15 @@ public static class Profile // Applied patch if (OS.IsWindows || OS.IsMac) progress.Report(66); - else if (OS.IsLinux) progress.Report(44); // Linux will take a bit longer, due to AppImage creation + else if (OS.IsLinux) + { + // Linux will take a bit longer, due to AppImage creation + #if NOAPPIMAGE + progress.Report(66); + #else + progress.Report(44); + #endif + } log.Info("xdelta patch(es) applied."); // Install new datafiles @@ -607,7 +615,7 @@ public static class Profile // Decompile AM2RWrapper.apk //TODO: double check if this still works on machines with non-ascii characters. See explanation in CrossPlatformOperations.PatchXdelta - CrossPlatformOperations.RunJavaJar($"\"{apktoolPath}\" d \"{dataPath}/android/AM2RWrapper.apk\"", tempDir); + CrossPlatformOperations.RunJavaJar($"\"{apktoolPath}\" --frame-path \"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/apktool/framework\" d \"{dataPath}/android/AM2RWrapper.apk\"", tempDir); log.Info("AM2RWrapper decompiled."); progress.Report(28); @@ -650,7 +658,7 @@ public static class Profile progress.Report(70); // Rebuild APK - CrossPlatformOperations.RunJavaJar($"\"{apktoolPath}\" b AM2RWrapper -o \"{profile.Name}.apk\"", tempDir); + CrossPlatformOperations.RunJavaJar($"\"{apktoolPath}\" --frame-path \"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/apktool/framework\" b AM2RWrapper -o \"{profile.Name}.apk\"", tempDir); log.Info($"AM2RWrapper rebuilt into {profile.Name}.apk."); progress.Report(84);