mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-11 21:37:47 +01:00
refactor: rename attributes for storing obfuscated filepath
This commit is contained in:
parent
c4e8f88499
commit
b32be8ca2a
@ -177,19 +177,19 @@ public class Androlib {
|
||||
|
||||
for (String file : files) {
|
||||
if (isAPKFileNames(file) && unk.getCompressionLevel(file) == 0) {
|
||||
String ext = "";
|
||||
String extOrFile = "";
|
||||
if (unk.getSize(file) != 0) {
|
||||
ext = FilenameUtils.getExtension(file);
|
||||
extOrFile = FilenameUtils.getExtension(file);
|
||||
}
|
||||
|
||||
if (ext.isEmpty() || !NO_COMPRESS_PATTERN.matcher(ext).find()) {
|
||||
ext = file;
|
||||
if (mAndRes.ObfFiles.containsKey(ext)) {
|
||||
ext = mAndRes.ObfFiles.get(ext);
|
||||
if (extOrFile.isEmpty() || !NO_COMPRESS_PATTERN.matcher(extOrFile).find()) {
|
||||
extOrFile = file;
|
||||
if (mAndRes.mResFileMapping.containsKey(extOrFile)) {
|
||||
extOrFile = mAndRes.mResFileMapping.get(extOrFile);
|
||||
}
|
||||
}
|
||||
if (!uncompressedFilesOrExts.contains(ext)) {
|
||||
uncompressedFilesOrExts.add(ext);
|
||||
if (!uncompressedFilesOrExts.contains(extOrFile)) {
|
||||
uncompressedFilesOrExts.add(extOrFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ final public class AndrolibResources {
|
||||
|
||||
LOGGER.info("Decoding file-resources...");
|
||||
for (ResResource res : pkg.listFiles()) {
|
||||
fileDecoder.decode(res, in, out, ObfFiles);
|
||||
fileDecoder.decode(res, in, out, mResFileMapping);
|
||||
}
|
||||
|
||||
LOGGER.info("Decoding values */* XMLs...");
|
||||
@ -1041,7 +1041,7 @@ final public class AndrolibResources {
|
||||
|
||||
public BuildOptions buildOptions;
|
||||
|
||||
public Map<String, String> ObfFiles = new HashMap();
|
||||
public Map<String, String> mResFileMapping = new HashMap();
|
||||
|
||||
// TODO: dirty static hack. I have to refactor decoding mechanisms.
|
||||
public static boolean sKeepBroken = false;
|
||||
|
@ -38,11 +38,11 @@ public class ResFileDecoder {
|
||||
this.mDecoders = decoders;
|
||||
}
|
||||
|
||||
public void decode(ResResource res, Directory inDir, Directory outDir, Map<String, String> obfFiles)
|
||||
public void decode(ResResource res, Directory inDir, Directory outDir, Map<String, String> resFileMapping)
|
||||
throws AndrolibException {
|
||||
|
||||
ResFileValue fileValue = (ResFileValue) res.getValue();
|
||||
String inFileFullName = fileValue.toString();
|
||||
String inFilePath = fileValue.toString();
|
||||
String inFileName = fileValue.getStrippedPath();
|
||||
String outResName = res.getFilePath();
|
||||
String typeName = res.getResSpec().getType().getName();
|
||||
@ -57,9 +57,9 @@ public class ResFileDecoder {
|
||||
outFileName = outResName + ext;
|
||||
}
|
||||
|
||||
String outFileFullName = "res/"+outFileName;
|
||||
if (!inFileFullName.equals(outFileFullName)) {
|
||||
obfFiles.put(inFileFullName, outFileFullName);
|
||||
String outFilePath = "res/" + outFileName;
|
||||
if (!inFilePath.equals(outFilePath)) {
|
||||
resFileMapping.put(inFilePath, outFilePath);
|
||||
}
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user