mirror of
https://github.com/revanced/revanced-cli.git
synced 2025-01-08 10:15:49 +01:00
refactor: change apk zip entry alignment to field
This commit is contained in:
parent
52c5259451
commit
978032cce1
@ -32,7 +32,7 @@ object ApkUtils {
|
|||||||
|
|
||||||
patchedEntriesSource.resourceFile?.let {
|
patchedEntriesSource.resourceFile?.let {
|
||||||
file.copyEntriesFromFileAligned(
|
file.copyEntriesFromFileAligned(
|
||||||
ZipFile(it), ZipAligner::getEntryAlignment
|
ZipFile(it), ZipAligner.apkZipEntryAlignment
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ object ApkUtils {
|
|||||||
|
|
||||||
// TODO: Fix copying resources that are not needed anymore.
|
// TODO: Fix copying resources that are not needed anymore.
|
||||||
file.copyEntriesFromFileAligned(
|
file.copyEntriesFromFileAligned(
|
||||||
ZipFile(apkFile), ZipAligner::getEntryAlignment
|
ZipFile(apkFile), ZipAligner.apkZipEntryAlignment
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,9 @@ object ZipAligner {
|
|||||||
private const val DEFAULT_ALIGNMENT = 4
|
private const val DEFAULT_ALIGNMENT = 4
|
||||||
private const val LIBRARY_ALIGNMENT = 4096
|
private const val LIBRARY_ALIGNMENT = 4096
|
||||||
|
|
||||||
fun getEntryAlignment(entry: ZipEntry): Int? =
|
val apkZipEntryAlignment = { entry: ZipEntry ->
|
||||||
if (entry.compression.toUInt() != 0u) null
|
if (entry.compression.toUInt() != 0u) null
|
||||||
else if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT
|
else if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT
|
||||||
else DEFAULT_ALIGNMENT
|
else DEFAULT_ALIGNMENT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user