mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: fix iOS delete NSCachesDirectory no permission
This commit is contained in:
@@ -300,7 +300,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
),
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '自动清除缓存',
|
title: '自动清除缓存',
|
||||||
subTitle: '每次启动时清除缓存(iOS不支持)',
|
subTitle: '每次启动时清除缓存',
|
||||||
leading: Icon(Icons.auto_delete_outlined),
|
leading: Icon(Icons.auto_delete_outlined),
|
||||||
setKey: SettingBoxKey.autoClearCache,
|
setKey: SettingBoxKey.autoClearCache,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
|
|||||||
@@ -137,7 +137,12 @@ class CacheManage {
|
|||||||
static Future clearLibraryCache() async {
|
static Future clearLibraryCache() async {
|
||||||
var appDocDir = await getTemporaryDirectory();
|
var appDocDir = await getTemporaryDirectory();
|
||||||
if (appDocDir.existsSync()) {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user