From 6138d263352cfeff8d55d45c3fd8eab547439c24 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Tue, 23 Sep 2014 08:32:04 -0500 Subject: [PATCH] prevent execution if file is named same as apktool framework folder --- .../java/brut/androlib/res/AndrolibResources.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 f0e5c0bd..e4ef395f 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 @@ -714,14 +714,21 @@ final public class AndrolibResources { } File dir = new File(path); - if (!dir.exists()) { - if (!dir.mkdirs()) { + + if (dir.getParentFile().isFile()) { + System.err.println("Please remove file at " + dir.getParentFile()); + System.exit(1); + } + + if (! dir.exists()) { + if (! dir.mkdirs()) { if (sFrameworkFolder != null) { System.err.println("Can't create Framework directory: " + dir); } throw new AndrolibException("Can't create directory: " + dir); } } + return dir; }