Skip to content

bug: Failed to delete temp filesΒ #327

Open
@EnricoTirri

Description

@EnricoTirri

Bug description

  • When selecting "-p" option in order to purge temp files after patch, severe error appears on deleting and all classes.dex files are preserved.

Error logs

No response

Solution

Seams like after

PatchCommand.kt :: 317
// region Save
apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply {  
    patcherResult.applyTo(this)  
}  

All "files" contained in

patcherResult.dexFiles

Have streams open, and this prevents OS to delete them
A possible solution, since that streams are not used anymore, is to close them one by one:

// region Save
apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply {
    patcherResult.applyTo(this)
    patcherResult.dexFiles.forEach{it.stream.close()}
}

Additional context

No response

Acknowledgements

  • This issue is not a duplicate of an existing bug report.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug reportSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions