mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-12 13:57:46 +01:00
Create file containing the do-not-compress extensions and pass it to aapt.
This commit is contained in:
parent
11ea666c13
commit
5d488e5f22
@ -317,6 +317,29 @@ final public class AndrolibResources {
|
||||
return Integer.toString(target);
|
||||
}
|
||||
|
||||
private File createDoNotCompressExtensionsFile(ApkOptions apkOptions) throws AndrolibException {
|
||||
if (apkOptions.doNotCompress == null || apkOptions.doNotCompress.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
File doNotCompressFile;
|
||||
try {
|
||||
doNotCompressFile = File.createTempFile("APKTOOL", null);
|
||||
doNotCompressFile.deleteOnExit();
|
||||
|
||||
BufferedWriter fileWriter = new BufferedWriter(new FileWriter(doNotCompressFile));
|
||||
for (String extension : apkOptions.doNotCompress) {
|
||||
fileWriter.write(extension);
|
||||
fileWriter.newLine();
|
||||
}
|
||||
fileWriter.close();
|
||||
|
||||
return doNotCompressFile;
|
||||
} catch (IOException ex) {
|
||||
throw new AndrolibException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void aapt2Package(File apkFile, File manifest, File resDir, File rawDir, File assetDir, File[] include,
|
||||
List<String> cmd)
|
||||
throws AndrolibException {
|
||||
@ -426,10 +449,9 @@ final public class AndrolibResources {
|
||||
}
|
||||
|
||||
if (apkOptions.doNotCompress != null) {
|
||||
for (String file : apkOptions.doNotCompress) {
|
||||
cmd.add("-0");
|
||||
cmd.add(file);
|
||||
}
|
||||
String extensionsFilePath = createDoNotCompressExtensionsFile(apkOptions).getAbsolutePath();
|
||||
cmd.add("-e");
|
||||
cmd.add(extensionsFilePath);
|
||||
}
|
||||
|
||||
if (!apkOptions.resourcesAreCompressed) {
|
||||
@ -542,11 +564,11 @@ final public class AndrolibResources {
|
||||
}
|
||||
|
||||
if (apkOptions.doNotCompress != null) {
|
||||
for (String file : apkOptions.doNotCompress) {
|
||||
cmd.add("-0");
|
||||
cmd.add(file);
|
||||
}
|
||||
String extensionsFilePath = createDoNotCompressExtensionsFile(apkOptions).getAbsolutePath();
|
||||
cmd.add("-e");
|
||||
cmd.add(extensionsFilePath);
|
||||
}
|
||||
|
||||
if (!apkOptions.resourcesAreCompressed) {
|
||||
cmd.add("-0");
|
||||
cmd.add("arsc");
|
||||
|
Loading…
Reference in New Issue
Block a user