File tree 4 files changed +12
-23
lines changed
4 files changed +12
-23
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ part 'features/headers.dart';
21
21
part 'features/modification_date.dart' ;
22
22
part 'features/permissions.dart' ;
23
23
part 'functions/gather_file_sizes.dart' ;
24
- part 'functions/get_mime_type.dart' ;
25
24
part 'functions/handle_error.dart' ;
26
25
part 'functions/list_directory_contents.dart' ;
27
26
@@ -84,6 +83,7 @@ void main(List<String> arguments) async {
84
83
if (args.showFileTypeIcon) {
85
84
final String fileToProcess = directory.path + currentFile;
86
85
final FileSystemEntityType type = fileStat.type;
86
+
87
87
output += showFileIcon (
88
88
fileToProcess,
89
89
type,
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ String showFileIcon(
6
6
bool showHeaders = false ,
7
7
}) {
8
8
String output = '' ;
9
- String ? mimeType;
10
9
String ? icon;
11
10
String ? color;
12
11
@@ -18,17 +17,15 @@ String showFileIcon(
18
17
// TODO: Handle this case.
19
18
break ;
20
19
default :
21
- mimeType = getMimeType (file);
22
- if (mimeType != null ) {
23
- // We have a mime type, so let's check if it's in the list of known file types.
24
- mimeType = mimeType.split ('/' )[1 ];
25
- final Map ? data = iconSet[mimeType];
20
+ final String mimeType =
21
+ lookupMimeType (file)? .split ('/' )[1 ] ?? file.split ('.' ).last;
26
22
27
- // The file type has been found in the list of known file types.
28
- if (data != null ) {
29
- icon = data['icon' ] as String ? ;
30
- color = data['color' ] as String ? ;
31
- }
23
+ final Map <String , String >? data = iconSet[mimeType];
24
+
25
+ // The file type has been found in the list of known file types.
26
+ if (data != null ) {
27
+ icon = data['icon' ];
28
+ color = data['color' ];
32
29
}
33
30
break ;
34
31
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ environment:
10
10
dev_dependencies :
11
11
flutter_lints : ^2.0.0
12
12
dependencies :
13
- args : ^2.2 .0
14
- intl : ^0.18.1
15
- mime : ^1.0.1
13
+ args : ^2.4 .0
14
+ intl : ^0.18.0
15
+ mime : ^1.0.0
16
16
path : ^1.8.0
You can’t perform that action at this time.
0 commit comments