|
@@ -1606,14 +1606,16 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
this.table.deleteData(item, () => {
|
|
this.table.deleteData(item, () => {
|
|
|
- FileUtil.unlink(filePath).then(() => {
|
|
|
|
|
- this.videoLocalList.splice(Number(index), 1)
|
|
|
|
|
- this.deleteCache(this.currentPath)
|
|
|
|
|
- this.getSortedFiles(this.currentPath, true)
|
|
|
|
|
-
|
|
|
|
|
- }).catch((error: BusinessError) => {
|
|
|
|
|
- console.error(error.message);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ FileUtil.unlink(filePath)
|
|
|
|
|
+ .catch((error: BusinessError) => {
|
|
|
|
|
+ console.error(error.message);
|
|
|
|
|
+ // 可以根据 error.code 判断是否为“文件不存在”,如需特殊处理
|
|
|
|
|
+ })
|
|
|
|
|
+ .finally(() => {
|
|
|
|
|
+ this.videoLocalList.splice(Number(index), 1)
|
|
|
|
|
+ this.deleteCache(this.currentPath)
|
|
|
|
|
+ this.getSortedFiles(this.currentPath, true)
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2105,16 +2107,15 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
this.table.deleteData(item, () => {
|
|
this.table.deleteData(item, () => {
|
|
|
- FileUtil.unlink(item.filePath).then(() => {
|
|
|
|
|
|
|
+ FileUtil.unlink(item.filePath).catch((error: Error) => {
|
|
|
|
|
+ console.error(error.message);
|
|
|
|
|
+ }).finally(()=>{
|
|
|
this.videoLocalList = this.videoLocalList.filter(v => v !== item);
|
|
this.videoLocalList = this.videoLocalList.filter(v => v !== item);
|
|
|
-
|
|
|
|
|
this.selectedFiles = [];
|
|
this.selectedFiles = [];
|
|
|
this.isMultiSelect = false
|
|
this.isMultiSelect = false
|
|
|
this.isAllSelected = false
|
|
this.isAllSelected = false
|
|
|
this.cache.delete(this.currentPath);
|
|
this.cache.delete(this.currentPath);
|
|
|
this.getSortedFiles(this.currentPath, true);
|
|
this.getSortedFiles(this.currentPath, true);
|
|
|
- }).catch((error: Error) => {
|
|
|
|
|
- console.error(error.message);
|
|
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|