@@ -142,17 +142,6 @@ internal object PatchCommand : Runnable {
142142 )
143143 private var signer = " ReVanced"
144144
145- @CommandLine.Option (
146- names = [" -r" , " --resource-cache" ],
147- description = [" Path to temporary resource cache directory." ],
148- )
149- private var resourceCachePath: File ? = null
150- set(value) {
151- logger.warning(" The --resource-cache option is deprecated. Use --temporary-files-patch instead." )
152- field = value
153- temporaryFilesPath = value
154- }
155-
156145 @CommandLine.Option (
157146 names = [" -t" , " --temporary-files-path" ],
158147 description = [" Path to temporary files directory." ],
@@ -184,7 +173,7 @@ internal object PatchCommand : Runnable {
184173 if (! apk.exists()) {
185174 throw CommandLine .ParameterException (
186175 spec.commandLine(),
187- " APK file ${apk.name } does not exist" ,
176+ " APK file ${apk.path } does not exist" ,
188177 )
189178 }
190179 this .apk = apk
@@ -197,7 +186,7 @@ internal object PatchCommand : Runnable {
197186 @Suppress(" unused" )
198187 private fun setIntegrations (integrations : Array <File >) {
199188 integrations.firstOrNull { ! it.exists() }?.let {
200- throw CommandLine .ParameterException (spec.commandLine(), " Integrations file ${it.name } does not exist." )
189+ throw CommandLine .ParameterException (spec.commandLine(), " Integrations file ${it.path } does not exist." )
201190 }
202191 this .integrations + = integrations
203192 }
@@ -273,12 +262,13 @@ internal object PatchCommand : Runnable {
273262 }
274263
275264 // endregion
265+ val patcherTemporaryFilesPath = temporaryFilesPath.resolve(" patcher" )
276266 val (packageName, patcherResult) = Patcher (
277267 PatcherConfig (
278268 apk,
279- temporaryFilesPath ,
269+ patcherTemporaryFilesPath ,
280270 aaptBinaryPath?.path,
281- temporaryFilesPath .absolutePath,
271+ patcherTemporaryFilesPath .absolutePath,
282272 true ,
283273 ),
284274 ).use { patcher ->
@@ -315,21 +305,22 @@ internal object PatchCommand : Runnable {
315305 }
316306
317307 // region Save
318-
319- apk.copyTo(outputFilePath, overwrite = true )
320-
321- patcherResult.applyTo(outputFilePath)
322-
323- if (! mount) {
324- outputFilePath.sign(
325- ApkUtils .SigningOptions (
326- keystoreFilePath,
327- keyStorePassword,
328- alias,
329- password,
330- signer,
331- ),
332- )
308+ apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true ).apply {
309+ patcherResult.applyTo(this )
310+ }.let {
311+ if (! mount) {
312+ sign(
313+ it,
314+ outputFilePath,
315+ ApkUtils .SigningOptions (
316+ keystoreFilePath,
317+ keyStorePassword,
318+ alias,
319+ password,
320+ signer,
321+ ),
322+ )
323+ }
333324 }
334325
335326 logger.info(" Saved to $outputFilePath " )
0 commit comments