@@ -2,6 +2,7 @@ import 'dart:async';
22import 'dart:io' ;
33
44import 'package:alist/l10n/intl_keys.dart' ;
5+ import 'package:alist/util/download/download_manager.dart' ;
56import 'package:alist/widget/alist_scaffold.dart' ;
67import 'package:flutter/material.dart' ;
78import 'package:flutter_smart_dialog/flutter_smart_dialog.dart' ;
@@ -60,6 +61,7 @@ class CacheManagerController extends GetxController {
6061
6162 final Set <String > _imageCachePaths = {};
6263 final Set <String > _audioCachePaths = {};
64+ String _downloadDir = "" ;
6365
6466 @override
6567 void onInit () {
@@ -69,6 +71,7 @@ class CacheManagerController extends GetxController {
6971
7072 void _calculateCacheFilesSize () async {
7173 var temporaryDirectory = await getTemporaryDirectory ();
74+ _downloadDir = (await DownloadManager .acquireDownloadDirectory ()).path;
7275 if (isClosed) {
7376 return ;
7477 }
@@ -100,6 +103,8 @@ class CacheManagerController extends GetxController {
100103 } else if (_checkIsAudioPath (path)) {
101104 _audioCacheSize += filesSize;
102105 audioCacheSizeStr.value = _formatBytes (_audioCacheSize);
106+ } else if (path.startsWith (_downloadDir)) {
107+ // do nothing
103108 } else {
104109 _otherCacheSize += filesSize;
105110 debugPrint (entity.path);
@@ -214,6 +219,7 @@ class CacheManagerController extends GetxController {
214219 var excludePaths = < String > [];
215220 excludePaths.addAll (_imageCachePaths);
216221 excludePaths.addAll (_audioCachePaths);
222+ excludePaths.add (_downloadDir);
217223 await _deleteFilesByDirectory (temporaryDirectory,
218224 excludePaths: excludePaths);
219225
0 commit comments