fix: game path scan

This commit is contained in:
2024-09-11 20:41:14 +08:00
parent ba102bbab8
commit ffd32ec7ff
2 changed files with 19 additions and 80 deletions

View File

@ -129,9 +129,6 @@ class ToolsUIModel extends _$ToolsUIModel {
items.add(await _addPhotographyCard(context));
state = state.copyWith(items: items);
if (!context.mounted) return;
items.addAll(await _addLogCard(context));
state = state.copyWith(items: items);
if (!context.mounted) return;
items.addAll(await _addNvmePatchCard(context));
state = state.copyWith(items: items, isItemLoading: false);
} catch (e) {
@ -140,26 +137,6 @@ class ToolsUIModel extends _$ToolsUIModel {
}
}
Future<List<ToolsItemData>> _addLogCard(BuildContext context) async {
double logPathLen = 0;
try {
logPathLen =
(await File(await SCLoggerHelper.getLogFilePath() ?? "").length()) /
1024 /
1024;
} catch (_) {}
return [
ToolsItemData(
"rsilauncher_log_fix",
S.current.tools_action_rsi_launcher_log_fix,
S.current.tools_action_info_rsi_launcher_log_issue(
logPathLen.toStringAsFixed(4)),
const Icon(FontAwesomeIcons.bookBible, size: 24),
onTap: () => _rsiLogFix(context),
),
];
}
Future<List<ToolsItemData>> _addNvmePatchCard(BuildContext context) async {
final nvmePatchStatus = await SystemHelper.checkNvmePatchStatus();
return [
@ -353,28 +330,6 @@ class ToolsUIModel extends _$ToolsUIModel {
SystemHelper.checkAndLaunchRSILauncher(state.rsiLauncherInstalledPath);
}
Future<void> _rsiLogFix(BuildContext context) async {
state = state.copyWith(working: true);
final path = await SCLoggerHelper.getLogFilePath();
if (!await File(path!).exists()) {
if (!context.mounted) return;
showToast(context, S.current.tools_action_info_log_file_not_exist);
return;
}
try {
SystemHelper.killRSILauncher();
await File(path).delete(recursive: true);
if (!context.mounted) return;
showToast(context, S.current.tools_action_info_cleanup_complete);
SystemHelper.checkAndLaunchRSILauncher(state.rsiLauncherInstalledPath);
} catch (_) {
if (!context.mounted) return;
showToast(context, S.current.tools_action_info_cleanup_failed(path));
}
state = state.copyWith(working: false);
}
openDir(path) async {
SystemHelper.openDir(path);
}