explore_ method

void explore_()

Displays a File or Directory in the host operating system's file explorer.

Implementation

void explore_() async {
  if (Platform.isLinux) {
    await Process.start(
      'dbus-send',
      [
        '--session',
        '--print-reply',
        '--dest=org.freedesktop.FileManager1',
        '--type=method_call',
        '/org/freedesktop/FileManager1',
        'org.freedesktop.FileManager1.ShowItems',
        'array:string:$uri',
        'string:""',
      ],
      runInShell: true,
      includeParentEnvironment: true,
      mode: ProcessStartMode.detached,
    );
  }
  if (Platform.isMacOS) {
    await Process.start(
      'open',
      [
        '-R',
        removePrefix(path),
      ],
      runInShell: true,
      includeParentEnvironment: true,
      mode: ProcessStartMode.detached,
    );
  }
  if (Platform.isWindows) {
    await Process.start(
      'explorer.exe',
      [
        '/select,',
        removePrefix(path),
      ],
      runInShell: true,
      includeParentEnvironment: true,
      mode: ProcessStartMode.detached,
    );
  }
}