mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 11:12:23 +01:00
Switched to getx for state management
Fixed last remaining bug
This commit is contained in:
29
lib/src/util/binary.dart
Normal file
29
lib/src/util/binary.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'dart:io';
|
||||
|
||||
Future<File> loadBinary(String binary, bool safe) async{
|
||||
var safeBinary = File("$safeBinariesDirectory/$binary");
|
||||
if(await safeBinary.exists()){
|
||||
return safeBinary;
|
||||
}
|
||||
|
||||
var internal = _locateInternalBinary(binary);
|
||||
if(!safe){
|
||||
return internal;
|
||||
}
|
||||
|
||||
if(await internal.exists()){
|
||||
await internal.copy(safeBinary.path);
|
||||
}
|
||||
|
||||
return safeBinary;
|
||||
}
|
||||
|
||||
File _locateInternalBinary(String binary){
|
||||
return File("$internalBinariesDirectory\\$binary");
|
||||
}
|
||||
|
||||
String get internalBinariesDirectory =>
|
||||
"${File(Platform.resolvedExecutable).parent.path}\\data\\flutter_assets\\assets\\binaries";
|
||||
|
||||
String get safeBinariesDirectory =>
|
||||
"${Platform.environment["UserProfile"]}\\.reboot_launcher";
|
||||
Reference in New Issue
Block a user