overwrite extracted shared lib rather than delete in shutdown hook #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #10
Reworks how Util extracts jaylib-ffm resources from the library jar into the temp dir to workaround an AccessDeniedException when deleting extracted files on shutdown.
Deletion of the extracted files on shutdown fails due to raylib_h_1.LIBRARY_ARENA being automatically managed. This results in the raylib shared lib still being loaded in the jvm at the time the shutdown hook runs, causing the AccessDeniedException.
While we could manually manage the lifetime of the library arena, that doesn't handle cases where the jvm or the native lib crashes or otherwise shuts down unexpectedly such that the shutdown hook doesn't run, resulting in dangling temp files that never get cleaned up.
Instead of extracting resources as a randomly named file on each run, always extract the files using their actual file names into a subdirectory of the system temp directory named: 'jaylib-ffm'. This allows the extracted files to be reliably overwritten on launch rather than trying to delete the extracted files on shutdown.