Gracefully handle deletion of files in app cache
This commit is contained in:
parent
49a42cf2ac
commit
6e1f5558af
1 changed files with 4 additions and 1 deletions
|
@ -274,7 +274,10 @@ Future<List<String>> _tryDeleteSharedMediaFiles(List<String> localIDs) {
|
|||
"/" +
|
||||
id.replaceAll(kSharedMediaIdentifier, '');
|
||||
try {
|
||||
await io.File(localPath).delete();
|
||||
// verify the file exists as the OS may have already deleted it from cache
|
||||
if (io.File(localPath).existsSync()) {
|
||||
await io.File(localPath).delete();
|
||||
}
|
||||
actuallyDeletedIDs.add(id);
|
||||
} catch (e, s) {
|
||||
_logger.warning("Could not delete file " + id, e, s);
|
||||
|
|
Loading…
Add table
Reference in a new issue