Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Failed to delete temp files #327

Open
3 tasks done
EnricoTirri opened this issue Apr 6, 2024 · 0 comments
Open
3 tasks done

bug: Failed to delete temp files #327

EnricoTirri opened this issue Apr 6, 2024 · 0 comments
Labels
Bug report Something isn't working

Comments

@EnricoTirri
Copy link

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.
@EnricoTirri EnricoTirri added the Bug report Something isn't working label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant