mirror of
https://github.com/TheGreatPepix/YAMD.git
synced 2026-11-03 01:33:02 +01:00
28 lines
626 B
Dart
28 lines
626 B
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
class Desktop {
|
|
void open(String target) {
|
|
if (Platform.isWindows) {
|
|
if (target.startsWith('http')) {
|
|
Process.run('rundll32', ['url.dll,FileProtocolHandler', target]);
|
|
} else {
|
|
Process.run('explorer.exe', [target]);
|
|
}
|
|
return;
|
|
}
|
|
Process.run(Platform.isMacOS ? 'open' : 'xdg-open', [target]);
|
|
}
|
|
|
|
void reveal(String file) {
|
|
if (Platform.isWindows) {
|
|
Process.run('explorer.exe', ['/select,', file]);
|
|
} else {
|
|
open(File(file).parent.path);
|
|
}
|
|
}
|
|
|
|
void quit() => SystemNavigator.pop();
|
|
}
|