mirror of
https://github.com/skylot/jadx.git
synced 2024-11-26 22:20:50 +00:00
fix(res): don't rename resource entries when useRawResName = true (PR #2306)
Some checks failed
Build Artifacts / build (push) Has been cancelled
Build Artifacts / build-win-bundle (push) Has been cancelled
Build Test / tests (ubuntu-latest) (push) Has been cancelled
Build Test / tests (windows-latest) (push) Has been cancelled
CodeQL / Analyze (java) (push) Has been cancelled
Validate Gradle Wrapper / Validation (push) Has been cancelled
Some checks failed
Build Artifacts / build (push) Has been cancelled
Build Artifacts / build-win-bundle (push) Has been cancelled
Build Test / tests (ubuntu-latest) (push) Has been cancelled
Build Test / tests (windows-latest) (push) Has been cancelled
CodeQL / Analyze (java) (push) Has been cancelled
Validate Gradle Wrapper / Validation (push) Has been cancelled
This commit is contained in:
parent
8f3cc3e8c1
commit
958ab245ae
@ -425,20 +425,26 @@ public class ResTableBinaryParser extends CommonBinaryParser implements IResTabl
|
||||
return STUB_ENTRY;
|
||||
}
|
||||
|
||||
String resName = getResName(typeName, resRef, origKeyName);
|
||||
ResourceEntry newResEntry = new ResourceEntry(resRef, pkg.getName(), typeName, resName, config);
|
||||
ResourceEntry prevResEntry = resStorage.searchEntryWithSameName(newResEntry);
|
||||
if (prevResEntry != null) {
|
||||
newResEntry = newResEntry.copyWithId();
|
||||
ResourceEntry newResEntry;
|
||||
if (useRawResName) {
|
||||
newResEntry = new ResourceEntry(resRef, pkg.getName(), typeName, origKeyName, config);
|
||||
} else {
|
||||
String resName = getResName(typeName, resRef, origKeyName);
|
||||
newResEntry = new ResourceEntry(resRef, pkg.getName(), typeName, resName, config);
|
||||
ResourceEntry prevResEntry = resStorage.searchEntryWithSameName(newResEntry);
|
||||
if (prevResEntry != null) {
|
||||
newResEntry = newResEntry.copyWithId();
|
||||
|
||||
// rename also previous entry for consistency
|
||||
ResourceEntry replaceForPrevEntry = prevResEntry.copyWithId();
|
||||
resStorage.replace(prevResEntry, replaceForPrevEntry);
|
||||
resStorage.addRename(replaceForPrevEntry);
|
||||
}
|
||||
if (!Objects.equals(origKeyName, newResEntry.getKeyName())) {
|
||||
resStorage.addRename(newResEntry);
|
||||
// rename also previous entry for consistency
|
||||
ResourceEntry replaceForPrevEntry = prevResEntry.copyWithId();
|
||||
resStorage.replace(prevResEntry, replaceForPrevEntry);
|
||||
resStorage.addRename(replaceForPrevEntry);
|
||||
}
|
||||
if (!Objects.equals(origKeyName, newResEntry.getKeyName())) {
|
||||
resStorage.addRename(newResEntry);
|
||||
}
|
||||
}
|
||||
|
||||
resStorage.add(newResEntry);
|
||||
return newResEntry;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user