Skip to content

Commit

Permalink
mod: fix iOS delete NSCachesDirectory no permission
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Aug 18, 2024
1 parent 4f6ef8d commit d4eb95d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pages/setting/extra_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
),
const SetSwitchItem(
title: '自动清除缓存',
subTitle: '每次启动时清除缓存(iOS不支持)',
subTitle: '每次启动时清除缓存',
leading: Icon(Icons.auto_delete_outlined),
setKey: SettingBoxKey.autoClearCache,
defaultVal: false,
Expand Down
7 changes: 6 additions & 1 deletion lib/utils/cache_manage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ class CacheManage {
static Future clearLibraryCache() async {
var appDocDir = await getTemporaryDirectory();
if (appDocDir.existsSync()) {
await appDocDir.delete(recursive: true);
// await appDocDir.delete(recursive: true);
final List<FileSystemEntity> children =
appDocDir.listSync(recursive: false);
for (final FileSystemEntity file in children) {
await file.delete(recursive: true);
}
}
}

Expand Down

0 comments on commit d4eb95d

Please sign in to comment.