feat: improve desktop path selection and USB connection recovery
This commit is contained in:
1 parent
5aa575f182
commit
6490665af8
28 files changed
+846
-51
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
Future<String?> pickPath(String value, {bool executable = false}) async {
|
||||
final directory = value.isEmpty ? null : p.dirname(value);
|
||||
final selected = await openFile(
|
||||
initialDirectory: directory != null && Directory(directory).existsSync()
|
||||
? directory
|
||||
: null,
|
||||
acceptedTypeGroups: executable
|
||||
? [
|
||||
const XTypeGroup(label: '可执行程序', extensions: ['exe']),
|
||||
]
|
||||
: [],
|
||||
);
|
||||
return selected?.path;
|
||||
}
|
||||
Reference in new issue
Block a user