Skip to content

Commit 69ee710

Browse files
committed
fixes iBotPeaches#427, correctly handles --frame-path on build
1 parent ba00d53 commit 69ee710

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

CHANGES

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ v1.5.3 (TBA)
55
-Updated to Gradle 1.4
66
-Updated known bytes for configurations to 38 (from addition of layout direction)
77
-Fixed NPE when handling odex apks even with --no-src specified. (Thanks Rodrigo Chiossi)
8+
-Fixed (issue #427) - Correctly handles `--frame-path` on [b]uild
89

910
v1.5.2 (Released February 2 - 2013) Codename: Bug Fixes
1011
-Fixed (issue #299) - output smali filename errors to screen during rebuild instead of filestream

brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ private static void cmdDecode(String[] args) throws InvalidArgsError,
120120
decoder.setKeepBrokenResources(true);
121121
} else if ("--frame-path".equals(opt)) {
122122
i++;
123-
System.out.println("Using Framework Directory: " + args[i]);
123+
if (i >= args.length) {
124+
throw new InvalidArgsError();
125+
}
124126
decoder.setFrameworkDir(args[i]);
125127
} else {
126128
throw new InvalidArgsError();
@@ -172,6 +174,8 @@ private static void cmdDecode(String[] args) throws InvalidArgsError,
172174

173175
private static void cmdBuild(String[] args) throws BrutException {
174176

177+
Androlib instance = new Androlib();
178+
175179
// hold all the fields
176180
HashMap<String, Boolean> flags = new HashMap<String, Boolean>();
177181
flags.put("forceBuildAll", false);
@@ -199,6 +203,9 @@ private static void cmdBuild(String[] args) throws BrutException {
199203
} else if ("-a".equals(opt) || "--aapt".equals(opt)) {
200204
mAaptPath = args[i + 1];
201205
skip = 1;
206+
} else if ("--frame-path".equals(opt)) {
207+
i++;
208+
instance.setFrameworkFolder(args[i]);
202209
} else if ("-o".equals(opt) || "--original".equals(opt)) {
203210
if (args.length >= 4) {
204211
throw new InvalidArgsError();
@@ -227,7 +234,7 @@ private static void cmdBuild(String[] args) throws BrutException {
227234
throw new InvalidArgsError();
228235
}
229236

230-
new Androlib().build(new File(appDirName), outFile, flags, mOrigApk,
237+
instance.build(new File(appDirName), outFile, flags, mOrigApk,
231238
mAaptPath);
232239
}
233240

@@ -331,6 +338,8 @@ private static void usage() {
331338
+ " Build in debug mode. Check project page for more info.\n"
332339
+ " -a, --aapt\n"
333340
+ " Loads aapt from specified location.\n"
341+
+ " --frame-path <dir>\n"
342+
+ " Use the specified directory for framework files\n"
334343
+ "\n"
335344
+ " if|install-framework <framework.apk> [<tag>] --frame-path [<location>] \n"
336345
+ " Install framework file to your system.\n"

brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java

+4
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,10 @@ private File[] newFiles(String[] names, File dir) {
534534
public void setApkFile(File apkFile) {
535535
mOrigApkFile = new ExtFile(apkFile);
536536
}
537+
538+
public void setFrameworkFolder(String path) {
539+
mAndRes.setFrameworkFolder(path);
540+
}
537541

538542
private ExtFile mOrigApkFile = null;
539543
private String mAaptPath = null;

brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -704,12 +704,11 @@ private File getFrameworkDir() throws AndrolibException {
704704
path = sFrameworkFolder;
705705
} else if (System.getProperty("os.name").equals("Mac OS X")) {
706706
// store in user-home, for Mac OS X
707-
path = System.getProperty("user.home") + File.separatorChar
708-
+ "Library/apktool/framework";
707+
path = System.getProperty("user.home") + File.separatorChar + "Library/apktool/framework";
709708
} else {
710-
path = System.getProperty("user.home") + File.separatorChar
711-
+ "apktool" + File.separatorChar + "framework";
709+
path = System.getProperty("user.home") + File.separatorChar + "apktool" + File.separatorChar + "framework";
712710
}
711+
713712
File dir = new File(path);
714713
if (!dir.exists()) {
715714
if (!dir.mkdirs()) {

0 commit comments

Comments
 (0)