mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-01-13 11:40:27 +00:00
fix: shader clean
This commit is contained in:
parent
13875f850f
commit
3f6a9f44d4
@ -11,6 +11,7 @@ import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
||||
import 'package:starcitizen_doctor/data/game_performance_data.dart';
|
||||
import 'package:starcitizen_doctor/generated/l10n.dart';
|
||||
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
|
||||
import 'package:starcitizen_doctor/ui/tools/tools_ui_model.dart';
|
||||
|
||||
import 'performance_ui.json.dart';
|
||||
|
||||
@ -171,15 +172,7 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
|
||||
}
|
||||
|
||||
Future<void> cleanShaderCache(BuildContext? context) async {
|
||||
final gameShaderCachePath = await SCLoggerHelper.getShaderCachePath();
|
||||
final l = await Directory(gameShaderCachePath!).list(recursive: false).toList();
|
||||
for (var value in l) {
|
||||
if (value is Directory) {
|
||||
if (!value.absolute.path.contains("Crashes")) {
|
||||
await value.delete(recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
await ToolsUIModel.cleanShaderCache();
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
if (context != null && context.mounted) {
|
||||
showToast(context, S.current.performance_info_shader_clearing_warning);
|
||||
|
||||
@ -27,6 +27,7 @@ import 'dialogs/hosts_booster_dialog_ui.dart';
|
||||
import 'dialogs/rsi_launcher_enhance_dialog_ui.dart';
|
||||
|
||||
part 'tools_ui_model.g.dart';
|
||||
|
||||
part 'tools_ui_model.freezed.dart';
|
||||
|
||||
class ToolsItemData {
|
||||
@ -518,8 +519,7 @@ class ToolsUIModel extends _$ToolsUIModel {
|
||||
state = state.copyWith(working: false);
|
||||
}
|
||||
|
||||
Future<void> _cleanShaderCache(BuildContext context) async {
|
||||
state = state.copyWith(working: true);
|
||||
static Future<void> cleanShaderCache() async {
|
||||
final gameShaderCachePath = await SCLoggerHelper.getShaderCachePath();
|
||||
final l = await Directory(gameShaderCachePath!).list(recursive: false).toList();
|
||||
for (var value in l) {
|
||||
@ -535,13 +535,18 @@ class ToolsUIModel extends _$ToolsUIModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _cleanShaderCache(BuildContext context) async {
|
||||
state = state.copyWith(working: true);
|
||||
await cleanShaderCache();
|
||||
if (!context.mounted) return;
|
||||
loadToolsCard(context, skipPathScan: true);
|
||||
state = state.copyWith(working: false);
|
||||
}
|
||||
|
||||
/// 清理着色器缓存目录,保留 GraphicsSettings 文件夹
|
||||
Future<void> _cleanShaderCacheDirectory(Directory dir) async {
|
||||
static Future<void> _cleanShaderCacheDirectory(Directory dir) async {
|
||||
try {
|
||||
final contents = await dir.list(recursive: false).toList();
|
||||
for (var entity in contents) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user