add windows as target
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// Opens a folder in the native file explorer.
|
||||
/// Returns true if a launch was attempted.
|
||||
Future<bool> openFolder(String path) async {
|
||||
if (path.isEmpty) return false;
|
||||
try {
|
||||
if (kIsWeb) return false;
|
||||
if (Platform.isWindows) {
|
||||
await Process.run('explorer', [path]);
|
||||
return true;
|
||||
} else if (Platform.isMacOS) {
|
||||
await Process.run('open', [path]);
|
||||
return true;
|
||||
} else if (Platform.isLinux) {
|
||||
await Process.run('xdg-open', [path]);
|
||||
return true;
|
||||
}
|
||||
} catch (_) {
|
||||
// ignore errors; caller can show a message
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user