diff --git a/CHANGES b/CHANGES index 3f165e7e..17ccce14 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ v1.5.2 (TBA) -Fixed (issue #394) - Prevented duplicated files in final jar which saved around 1.2mb. -Added Proguard to drop final jar size from 6.2mb to 2.6mb. -Fixed (issue #395) - Added check for "aapt" in unit-tests. +-Added ability to use "--frame-path" on [if|install-framework] v1.5.1 PR3 (Released December 23 - 2012) Codename: Pre Release 3 -Reverted "Prevents removal of on decompile, but then throws warning on rebuild (issue #366)" diff --git a/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java b/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java index 649506c3..e84435ed 100644 --- a/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java +++ b/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java @@ -226,11 +226,23 @@ public class Main { private static void cmdInstallFramework(String[] args) throws AndrolibException { String tag = null; + String frame_path = null; + int i = 0; switch (args.length) { + case 4: + if (args[2].equalsIgnoreCase("--frame-path")) { + i++; + } else { + throw new InvalidArgsError(); + } + case 3: + frame_path = args[2 + i]; case 2: - tag = args[1]; + if (!(args[1].equalsIgnoreCase("--frame-path"))) { + tag = args[1]; + } case 1: - new Androlib().installFramework(new File(args[0]), tag); + new Androlib().installFramework(new File(args[0]), tag,frame_path); return; } @@ -305,7 +317,7 @@ public class Main { // " -o, --original\n" + // " Build resources into original APK. Retains signature." + "\n" + - " if|install-framework []\n" + + " if|install-framework [] --frame-path [] \n" + " Install framework file to your system.\n" + "\n" + "For additional info, see: http://code.google.com/p/android-apktool/" + diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java index 6a2e7441..3b1f7cb6 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java @@ -493,8 +493,9 @@ public class Androlib { mAndRes.publicizeResources(arscFile); } - public void installFramework(File frameFile, String tag) + public void installFramework(File frameFile, String tag, String frame_path) throws AndrolibException { + mAndRes.setFrameworkFolder(frame_path); mAndRes.installFramework(frameFile, tag); } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java index a3b66a8a..d3111319 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java @@ -648,11 +648,11 @@ final public class AndrolibResources { private File getFrameworkDir() throws AndrolibException { String path; - /* if a framework path was specified on the command line, use it */ + // if a framework path was specified on the command line, use it if (sFrameworkFolder != null) { path = sFrameworkFolder; } else if (System.getProperty("os.name").equals("Mac OS X")) { - /* store in user-home, for Mac OS X */ + // store in user-home, for Mac OS X path = System.getProperty("user.home") + File.separatorChar + "Library/apktool/framework"; } else { @@ -663,8 +663,7 @@ final public class AndrolibResources { if (!dir.exists()) { if (!dir.mkdirs()) { if (sFrameworkFolder != null) { - System.out.println("Can't create Framework directory: " - + dir); + System.out.println("Can't create Framework directory: " + dir); } throw new AndrolibException("Can't create directory: " + dir); } @@ -680,6 +679,10 @@ final public class AndrolibResources { throw new AndrolibException(ex); } } + + public void setFrameworkFolder(String path) { + sFrameworkFolder = path; + } // TODO: dirty static hack. I have to refactor decoding mechanisms. public static boolean sKeepBroken = false;