mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-01 05:44:24 +02:00
fix: close open files (#75)
This commit is contained in:
parent
09f6ab4155
commit
123ad54c15
@ -49,6 +49,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
|
||||
init {
|
||||
val extInputFile = ExtFile(options.inputFile)
|
||||
try {
|
||||
val outDir = File(options.resourceCacheDirectory)
|
||||
if (outDir.exists()) {
|
||||
logger.info("Deleting existing resource cache directory")
|
||||
@ -113,6 +114,9 @@ class Patcher(private val options: PatcherOptions) {
|
||||
data = PatcherData(
|
||||
dexFile.classes.toMutableList(), options.resourceCacheDirectory, packageMetadata
|
||||
)
|
||||
} finally {
|
||||
extInputFile.close()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,7 +169,7 @@ class Patcher(private val options: PatcherOptions) {
|
||||
|
||||
if (options.patchResources) {
|
||||
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
||||
|
||||
try {
|
||||
val androlibResources = AndrolibResources().also { resources ->
|
||||
resources.buildOptions = BuildOptions().also { buildOptions ->
|
||||
buildOptions.setBuildOptions(options)
|
||||
@ -202,6 +206,9 @@ class Patcher(private val options: PatcherOptions) {
|
||||
)
|
||||
|
||||
resourceFile = aaptFile
|
||||
} finally {
|
||||
cacheDirectory.close()
|
||||
}
|
||||
}
|
||||
|
||||
logger.trace("Creating new dex file")
|
||||
|
Loading…
x
Reference in New Issue
Block a user