app name, id 추가

This commit is contained in:
Toki 2024-12-22 11:31:49 +09:00
parent 35081e3ec4
commit 3b7230d1a4
3 changed files with 9 additions and 16 deletions

View file

@ -10,7 +10,7 @@ import 'package:dart_framework/core/application.dart';
import 'package:dart_framework/charset.dart';
void main() async {
Application(() async {
Application('dartframework', 'com.toki-labs.dartframework',() async {
// isolate.test();
// var md5 = generateMd5('test');
// print('$md5 / ${md5.length}');

View file

@ -6,9 +6,9 @@ import 'package:dart_framework/utils/system_util.dart' as system;
class Application {
late Function(Object, StackTrace) writeLog;
Application(Function() func, Function(Object, StackTrace) errorListener) {
Application(String name, String appID, Function() func, Function(Object, StackTrace) errorListener) {
runZonedGuarded(() async {
await system.initialize();
await system.initialize(name, appID);
writeLog = (error, stack) => logError('$error:\n$stack');
func();
}, (error, stack) {

View file

@ -16,14 +16,17 @@ String dataPath = '';
String projectName = '';
String scriptPath = '';
String executablePath = '';
String appIdendifier = '';
String appName = '';
Future initialize() async {
Future initialize(String name, String appID) async {
isDebug = path.basename(Platform.resolvedExecutable) == 'dart';
userPath = await Path.userPath;
dataPath = await Path.dataPath;
projectName = await getProjectName();
scriptPath = Platform.script.toFilePath(windows: Platform.isWindows);
executablePath = Platform.executable;
appIdendifier = appID;
appName = name;
}
@ -130,14 +133,4 @@ Future<Uint8List?> readFileByte(String filePath) async {
});
c.complete(bytes);
return c.future;
}
Future<String> getProjectName() async {
var name =
path.dirname(Platform.script.toFilePath(windows: Platform.isWindows));
print(name);
if (path.basename(name) == 'bin') {
name = path.dirname(name);
}
return dataFutrue(path.basename(name));
}
}