mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-05 02:22:55 +01:00
Merge branch 'master' of github.com:iBotPeaches/Apktool
This commit is contained in:
commit
4410e466f5
@ -111,6 +111,10 @@ public class Main {
|
||||
decoder.setDecodeResources(ApkDecoder.DECODE_RESOURCES_NONE);
|
||||
} else if ("--keep-broken-res".equals(opt)) {
|
||||
decoder.setKeepBrokenResources(true);
|
||||
} else if ("--framework".equals(opt)) {
|
||||
i++;
|
||||
System.out.println("Using Framework Directory: " + args[i]);
|
||||
decoder.setFrameworkDir(args[i]);
|
||||
} else {
|
||||
throw new InvalidArgsError();
|
||||
}
|
||||
@ -262,6 +266,8 @@ public class Main {
|
||||
" Force delete destination directory.\n" +
|
||||
" -t <tag>, --frame-tag <tag>\n" +
|
||||
" Try to use framework files tagged by <tag>.\n" +
|
||||
" --framework <dir>\n" +
|
||||
" Use the specified directory for framework files" +
|
||||
" --keep-broken-res\n" +
|
||||
" Use if there was an error and some resources were dropped, e.g.:\n" +
|
||||
" \"Invalid config flags detected. Dropping resources\", but you\n" +
|
||||
|
@ -158,6 +158,10 @@ public class ApkDecoder {
|
||||
mKeepBrokenResources = keepBrokenResources;
|
||||
}
|
||||
|
||||
public void setFrameworkDir(String dir) {
|
||||
mFrameworkDir = dir;
|
||||
}
|
||||
|
||||
public ResTable getResTable() throws AndrolibException {
|
||||
if (mResTable == null) {
|
||||
boolean hasResources = hasResources();
|
||||
@ -167,6 +171,7 @@ public class ApkDecoder {
|
||||
"Apk doesn't contain either AndroidManifest.xml file or resources.arsc file");
|
||||
}
|
||||
AndrolibResources.sKeepBroken = mKeepBrokenResources;
|
||||
AndrolibResources.sFrameworkFolder = mFrameworkDir;
|
||||
mResTable = mAndrolib.getResTable(mApkFile, hasResources);
|
||||
mResTable.setFrameTag(mFrameTag);
|
||||
}
|
||||
@ -279,5 +284,6 @@ public class ApkDecoder {
|
||||
private boolean mForceDelete = false;
|
||||
private String mFrameTag;
|
||||
private boolean mKeepBrokenResources = false;
|
||||
private String mFrameworkDir = null;
|
||||
private boolean mBakDeb = true;
|
||||
}
|
||||
|
@ -556,8 +556,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 (sFrameworkFolder != null) {
|
||||
path = sFrameworkFolder;
|
||||
} else if (System.getProperty("os.name").equals("Mac OS X")) {
|
||||
/* store in user-home, for Mac OS X */
|
||||
if (System.getProperty("os.name").equals("Mac OS X")) {
|
||||
path = System.getProperty("user.home") + File.separatorChar +
|
||||
"Library/apktool/framework"; }
|
||||
else {
|
||||
@ -567,6 +570,9 @@ final public class AndrolibResources {
|
||||
File dir = new File(path);
|
||||
if (! dir.exists()) {
|
||||
if (! dir.mkdirs()) {
|
||||
if (sFrameworkFolder != null) {
|
||||
System.out.println("Can't create Framework directory: " + dir);
|
||||
}
|
||||
throw new AndrolibException("Can't create directory: " + dir);
|
||||
}
|
||||
}
|
||||
@ -584,7 +590,7 @@ final public class AndrolibResources {
|
||||
|
||||
// TODO: dirty static hack. I have to refactor decoding mechanisms.
|
||||
public static boolean sKeepBroken = false;
|
||||
|
||||
public static String sFrameworkFolder = null;
|
||||
|
||||
private final static Logger LOGGER =
|
||||
Logger.getLogger(AndrolibResources.class.getName());
|
||||
|
Loading…
Reference in New Issue
Block a user