JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
122 stars 23 forks source link

Temp folder does not delete on Exit #85

Closed derfurkan closed 2 months ago

derfurkan commented 5 months ago

When using the Core.initDownload() method, the files downloaded to the temporary directory are not deleted when the application quits, despite the code suggesting that they should be deleted. The relevant code snippet is as follows:

// Create a new temporary directory
// We need to do this, because we may not change the filename on Windows
File tempDir = new File(System.getProperty("java.io.tmpdir"), "java-"+name+System.nanoTime());
if(!tempDir.mkdir())
throw new IOException("Cannot create temporary directory");
tempDir.deleteOnExit();

// Create a temporary file inside our directory (with a "normal" name)
File temp = new File(tempDir, name+suffix);
temp.deleteOnExit();