Fix exception when old file doesn't exist

This commit is contained in:
comp500 2019-12-23 00:36:54 +00:00
parent a15489f5e4
commit e8538c22bc

View File

@ -188,7 +188,12 @@ internal class DownloadTask private constructor(val metadata: IndexFile.File, de
cachedFile?.cachedLocation?.let { cachedFile?.cachedLocation?.let {
if (destPath != Paths.get(packFolder, it)) { if (destPath != Paths.get(packFolder, it)) {
// Delete old file if location changes // Delete old file if location changes
try {
Files.delete(Paths.get(packFolder, cachedFile!!.cachedLocation)) Files.delete(Paths.get(packFolder, cachedFile!!.cachedLocation))
} catch (e: IOException) {
// Continue, as it was probably already deleted?
// TODO: log it
}
} }
} }
} catch (e: Exception) { } catch (e: Exception) {