Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Handle err while printing directory stat
Browse files Browse the repository at this point in the history
  • Loading branch information
ua741 committed Oct 12, 2023
1 parent 655c06b commit e3ba796
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/ui/tools/debug/app_storage_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import "package:logging/logging.dart";
import 'package:path_provider/path_provider.dart';
import 'package:photos/core/cache/video_cache_manager.dart';
import 'package:photos/core/configuration.dart';
Expand Down Expand Up @@ -29,6 +30,7 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
late String iosTempDirectoryPath;
late bool internalUser;
int _refreshCounterKey = 0;
final Logger _logger = Logger("_AppStorageViewerState");

@override
void initState() {
Expand Down Expand Up @@ -104,12 +106,16 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
}

Future<void> prettyStringDirectoryStats(List<String> paths) async {
for (var path in paths) {
final DirectoryStat state = await getDirectoryStat(Directory(path));
final content = prettyPrintDirectoryStat(state, path);
if (content.isNotEmpty) {
debugPrint(content);
try {
for (var path in paths) {
final DirectoryStat stat = await getDirectoryStat(Directory(path));
final content = prettyPrintDirectoryStat(stat, path);
if (content.isNotEmpty) {
_logger.info(content);
}
}
} catch (e) {
_logger.severe("Failed to print directory stats", e);
}
}

Expand Down

0 comments on commit e3ba796

Please sign in to comment.