This commit is contained in:
Alessandro Autiero
2022-09-24 20:17:30 +02:00
parent 1a0fbbdf30
commit 52af8ac646
18 changed files with 584 additions and 176 deletions

View File

@@ -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;
}