Files
谢宇宁andClaude Opus 5.5 2d26ea8f90 Initial commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 10:38:11 +07:00

33 lines
864 B
Dart

import 'dart:io';
import 'package:path_provider/path_provider.dart';
import '../debug_log.dart';
//图片磁盘缓存目录(2025-07 ~ 2026-06 的版本经 loadAndDecrypt 往里存过原图,当前无写入方,保留统计和清理给老用户兜底)
class ImageDiskCache {
static Future<String> findSavePath() async {
final directory = await getTemporaryDirectory();
String saveDir = '${directory.path}/cacheImage';
Directory root = Directory(saveDir);
if (!root.existsSync()) {
debugLog(saveDir);
await root.create();
}
return saveDir;
}
static Future<void> emptyCache() async {
try {
String saveDir = await findSavePath();
Directory root = Directory(saveDir);
if (root.existsSync()) {
await root.delete(recursive: true);
}
} catch (e) {
debugLog(e);
}
}
}