This commit is contained in:
2024-12-22 11:22:59 +08:00
parent e1b2f83c48
commit 0e22574002

View File

@@ -462,6 +462,7 @@ class LocalManager with ChangeNotifier {
void restoreDownloadingTasks() {
var file = File(FilePath.join(App.dataPath, 'downloading_tasks.json'));
if (file.existsSync()) {
try {
var tasks = jsonDecode(file.readAsStringSync());
for (var e in tasks) {
var task = DownloadTask.fromJson(e);
@@ -470,6 +471,11 @@ class LocalManager with ChangeNotifier {
}
}
}
catch(e) {
file.delete();
Log.error("LocalManager", "Failed to restore downloading tasks: $e");
}
}
}
void addTask(DownloadTask task) {