mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 11:12:23 +01:00
3.6
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_desktop_folder_picker/flutter_desktop_folder_picker.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
File errorFile = File("${Platform.environment["Temp"]}/error.txt");
|
||||
|
||||
const int appBarSize = 2;
|
||||
final RegExp _regex = RegExp(r'(?<=\(Build )(.*)(?=\))');
|
||||
|
||||
@@ -11,4 +16,31 @@ bool get isWin11 {
|
||||
|
||||
var intBuild = int.tryParse(result);
|
||||
return intBuild != null && intBuild > 22000;
|
||||
}
|
||||
|
||||
Future<String?> openFilePicker(String title) async =>
|
||||
FlutterDesktopFolderPicker.openFolderPickerDialog(title: title);
|
||||
|
||||
Future<List<Directory>> scanInstallations(String input) => Directory(input)
|
||||
.list(recursive: true)
|
||||
.handleError((_) {}, test: (e) => e is FileSystemException)
|
||||
.where((element) => path.basename(element.path) == "FortniteClient-Win64-Shipping.exe")
|
||||
.map((element) => findContainer(File(element.path)))
|
||||
.where((element) => element != null)
|
||||
.map((element) => element!)
|
||||
.toList();
|
||||
|
||||
Directory? findContainer(File file){
|
||||
var last = file.parent;
|
||||
for(var x = 0; x < 5; x++){
|
||||
var name = path.basename(last.path);
|
||||
if(name != "FortniteGame" || name == "Fortnite"){
|
||||
last = last.parent;
|
||||
continue;
|
||||
}
|
||||
|
||||
return last.parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user