mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-20 16:57:34 +01:00
prevents renaming manifest if package is "android" and fixes deletion of tmp files
This commit is contained in:
parent
04b5508c3a
commit
559ed2853a
@ -344,7 +344,7 @@ public class Androlib {
|
||||
APK_RESOURCES_WITHOUT_RES_FILENAMES);
|
||||
|
||||
// delete tmpDir
|
||||
OS.rmdir(tmpDir.toString());
|
||||
apkFile.delete();
|
||||
}
|
||||
return true;
|
||||
} catch (IOException ex) {
|
||||
@ -404,8 +404,6 @@ public class Androlib {
|
||||
Directory tmpDir = new ExtFile(apkFile).getDirectory();
|
||||
tmpDir.copyToDir(apkDir, APK_MANIFEST_FILENAMES);
|
||||
|
||||
// delete tmp
|
||||
OS.rmdir(apkDir.getAbsolutePath());
|
||||
}
|
||||
return true;
|
||||
} catch (IOException ex) {
|
||||
@ -454,6 +452,8 @@ public class Androlib {
|
||||
mAndRes.aaptPackage(outApk, null, null,
|
||||
new File(appDir, APK_DIRNAME), assetDir, null, flags);
|
||||
|
||||
|
||||
|
||||
/* check for re-insert */
|
||||
if (flags.get("injectOriginal")) {
|
||||
//try {
|
||||
|
@ -154,9 +154,12 @@ final public class AndrolibResources {
|
||||
public void adjust_package_manifest(ResTable resTable, String filePath)
|
||||
throws AndrolibException {
|
||||
|
||||
// check if packages different
|
||||
// check if packages different, and that package is not equal to "android"
|
||||
Map<String, String> packageInfo = resTable.getPackageInfo();
|
||||
if (!(packageInfo.get("cur_package").equalsIgnoreCase(packageInfo.get("orig_package")))) {
|
||||
if ((packageInfo.get("cur_package").equalsIgnoreCase(packageInfo.get("orig_package"))
|
||||
|| ("android".equalsIgnoreCase(packageInfo.get("cur_package"))))) {
|
||||
LOGGER.info("Regular manifest package...");
|
||||
} else {
|
||||
try {
|
||||
|
||||
LOGGER.info("Renamed manifest package found! Fixing...");
|
||||
|
@ -19,6 +19,8 @@ package brut.util;
|
||||
import brut.common.BrutException;
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
/**
|
||||
@ -40,6 +42,11 @@ public class OS {
|
||||
}
|
||||
dir.delete();
|
||||
}
|
||||
|
||||
public static void rmfile(String file) throws BrutException {
|
||||
File del = new File(file);
|
||||
del.delete();
|
||||
}
|
||||
|
||||
public static void rmdir(String dir) throws BrutException {
|
||||
rmdir(new File(dir));
|
||||
|
Loading…
x
Reference in New Issue
Block a user