mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 11:12:23 +01:00
43 lines
981 B
Dart
43 lines
981 B
Dart
import 'dart:io';
|
|
|
|
import 'package:path/path.dart' as path;
|
|
|
|
class FortniteVersion {
|
|
String name;
|
|
Directory location;
|
|
|
|
FortniteVersion.fromJson(json)
|
|
: name = json["name"],
|
|
location = Directory(json["location"]);
|
|
|
|
FortniteVersion({required this.name, required this.location});
|
|
|
|
static File? findExecutable(Directory directory, String name) {
|
|
try{
|
|
var result = directory.listSync(recursive: true)
|
|
.firstWhere((element) => path.basename(element.path) == name);
|
|
return File(result.path);
|
|
}catch(_){
|
|
return null;
|
|
}
|
|
}
|
|
|
|
File? get executable {
|
|
return findExecutable(location, "FortniteClient-Win64-Shipping.exe");
|
|
}
|
|
|
|
File? get launcher {
|
|
return findExecutable(location, "FortniteLauncher.exe");
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'name': name,
|
|
'location': location.path,
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return 'FortniteVersion{name: $name, location: $location}';
|
|
}
|
|
}
|