cleanup temporary assets

This commit is contained in:
Bixilon 2020-12-02 22:01:33 +01:00
parent 198ae51750
commit 4c3abc0a30
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -283,6 +283,10 @@ public class AssetsManager {
File outputFile = new File(getAssetDiskPath(hash));
Util.createParentFolderIfNotExist(outputFile);
if (outputFile.exists()) {
// file is already extracted
if (!tempDestinationFile.delete()) {
throw new RuntimeException(String.format("Could not delete temporary file %s", tempDestinationFile.getAbsolutePath()));
}
return hash;
}
if (!tempDestinationFile.renameTo(outputFile)) {