mirror of
https://github.com/revanced/Apktool.git
synced 2025-06-12 13:17:43 +02:00
Evolve Update-Framework to Empty Framework Directory
- allows emptying of framework via (empty-framework-dir) - checks in place to only delete files that are APKs, non recursive
This commit is contained in:
@ -684,8 +684,8 @@ public class Androlib {
|
||||
mAndRes.installFramework(frameFile);
|
||||
}
|
||||
|
||||
public void updateFramework() throws AndrolibException {
|
||||
mAndRes.updateFramework();
|
||||
public void emptyFrameworkDirectory() throws AndrolibException {
|
||||
mAndRes.emptyFrameworkDirectory();
|
||||
}
|
||||
|
||||
public boolean isFrameworkApk(ResTable resTable) {
|
||||
|
@ -591,16 +591,29 @@ final public class AndrolibResources {
|
||||
throw new CantFindFrameworkResException(id);
|
||||
}
|
||||
|
||||
public void updateFramework() throws AndrolibException {
|
||||
public void emptyFrameworkDirectory() throws AndrolibException {
|
||||
File dir = getFrameworkDir();
|
||||
File apk;
|
||||
|
||||
apk = new File(dir, "1.apk");
|
||||
|
||||
if (! apk.exists()) {
|
||||
LOGGER.warning("Can't update framework, no file found at: " + apk.getAbsolutePath());
|
||||
LOGGER.warning("Can't empty framework directory, no file found at: " + apk.getAbsolutePath());
|
||||
} else {
|
||||
|
||||
try {
|
||||
if (apk.exists() && dir.listFiles().length > 1 && ! apkOptions.forceDeleteFramework) {
|
||||
LOGGER.warning("More than default framework detected. Please run command with `--force` parameter to wipe framework directory.");
|
||||
} else {
|
||||
for (File file : dir.listFiles()) {
|
||||
if (file.isFile() && file.getName().endsWith(".apk")) {
|
||||
LOGGER.info("Removing " + file.getName() + " framework file...");
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
throw new AndrolibException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user