mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-01 13:44:25 +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 {
|
init {
|
||||||
val extInputFile = ExtFile(options.inputFile)
|
val extInputFile = ExtFile(options.inputFile)
|
||||||
|
try {
|
||||||
val outDir = File(options.resourceCacheDirectory)
|
val outDir = File(options.resourceCacheDirectory)
|
||||||
if (outDir.exists()) {
|
if (outDir.exists()) {
|
||||||
logger.info("Deleting existing resource cache directory")
|
logger.info("Deleting existing resource cache directory")
|
||||||
@ -113,6 +114,9 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
data = PatcherData(
|
data = PatcherData(
|
||||||
dexFile.classes.toMutableList(), options.resourceCacheDirectory, packageMetadata
|
dexFile.classes.toMutableList(), options.resourceCacheDirectory, packageMetadata
|
||||||
)
|
)
|
||||||
|
} finally {
|
||||||
|
extInputFile.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,7 +169,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
|
|
||||||
if (options.patchResources) {
|
if (options.patchResources) {
|
||||||
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
||||||
|
try {
|
||||||
val androlibResources = AndrolibResources().also { resources ->
|
val androlibResources = AndrolibResources().also { resources ->
|
||||||
resources.buildOptions = BuildOptions().also { buildOptions ->
|
resources.buildOptions = BuildOptions().also { buildOptions ->
|
||||||
buildOptions.setBuildOptions(options)
|
buildOptions.setBuildOptions(options)
|
||||||
@ -202,6 +206,9 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
resourceFile = aaptFile
|
resourceFile = aaptFile
|
||||||
|
} finally {
|
||||||
|
cacheDirectory.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Creating new dex file")
|
logger.trace("Creating new dex file")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user