mirror of
https://github.com/revanced/revanced-cli.git
synced 2025-01-21 08:27:31 +01:00
fix: Delete temporal files if it exists
This commit is contained in:
parent
978032cce1
commit
a022febd0c
@ -208,10 +208,10 @@ internal object PatchCommand : Runnable {
|
|||||||
|
|
||||||
// region Save
|
// region Save
|
||||||
|
|
||||||
val aligned = resourceCachePath.resolve(apk.name)
|
val tempFile = resourceCachePath.resolve(apk.name)
|
||||||
ApkUtils.align(apk, aligned, patcherResult)
|
ApkUtils.copyAligned(apk, tempFile, patcherResult)
|
||||||
if (!mount) ApkUtils.sign(
|
if (!mount) ApkUtils.sign(
|
||||||
aligned,
|
tempFile,
|
||||||
outputFilePath,
|
outputFilePath,
|
||||||
SigningOptions(
|
SigningOptions(
|
||||||
commonName,
|
commonName,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
public final class app/revanced/lib/ApkUtils {
|
public final class app/revanced/lib/ApkUtils {
|
||||||
public static final field INSTANCE Lapp/revanced/lib/ApkUtils;
|
public static final field INSTANCE Lapp/revanced/lib/ApkUtils;
|
||||||
public final fun align (Ljava/io/File;Ljava/io/File;Lapp/revanced/patcher/PatcherResult;)V
|
public final fun copyAligned (Ljava/io/File;Ljava/io/File;Lapp/revanced/patcher/PatcherResult;)V
|
||||||
public final fun sign (Ljava/io/File;Ljava/io/File;Lapp/revanced/lib/signing/SigningOptions;)V
|
public final fun sign (Ljava/io/File;Ljava/io/File;Lapp/revanced/lib/signing/SigningOptions;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public final class app/revanced/lib/signing/SigningOptions {
|
|||||||
|
|
||||||
public final class app/revanced/lib/zip/ZipAligner {
|
public final class app/revanced/lib/zip/ZipAligner {
|
||||||
public static final field INSTANCE Lapp/revanced/lib/zip/ZipAligner;
|
public static final field INSTANCE Lapp/revanced/lib/zip/ZipAligner;
|
||||||
public final fun getEntryAlignment (Lapp/revanced/lib/zip/structures/ZipEntry;)Ljava/lang/Integer;
|
public final fun getApkZipEntryAlignment ()Lkotlin/jvm/functions/Function1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/lib/zip/ZipFile : java/io/Closeable {
|
public final class app/revanced/lib/zip/ZipFile : java/io/Closeable {
|
||||||
|
@ -8,6 +8,7 @@ import app.revanced.lib.zip.structures.ZipEntry
|
|||||||
import app.revanced.patcher.PatcherResult
|
import app.revanced.patcher.PatcherResult
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
import kotlin.io.path.deleteIfExists
|
||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate", "unused")
|
@Suppress("MemberVisibilityCanBePrivate", "unused")
|
||||||
object ApkUtils {
|
object ApkUtils {
|
||||||
@ -20,9 +21,11 @@ object ApkUtils {
|
|||||||
* @param outputFile The apk to write the new entries to.
|
* @param outputFile The apk to write the new entries to.
|
||||||
* @param patchedEntriesSource The result of the patcher to add the patched dex files and resources.
|
* @param patchedEntriesSource The result of the patcher to add the patched dex files and resources.
|
||||||
*/
|
*/
|
||||||
fun align(apkFile: File, outputFile: File, patchedEntriesSource: PatcherResult) {
|
fun copyAligned(apkFile: File, outputFile: File, patchedEntriesSource: PatcherResult) {
|
||||||
logger.info("Aligning ${apkFile.name}")
|
logger.info("Aligning ${apkFile.name}")
|
||||||
|
|
||||||
|
outputFile.toPath().deleteIfExists()
|
||||||
|
|
||||||
ZipFile(outputFile).use { file ->
|
ZipFile(outputFile).use { file ->
|
||||||
patchedEntriesSource.dexFiles.forEach {
|
patchedEntriesSource.dexFiles.forEach {
|
||||||
file.addEntryCompressData(
|
file.addEntryCompressData(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user