Fix _Namespace not defined

This commit is contained in:
2024-02-03 11:19:19 +08:00
parent 4b1e4dfddc
commit 4d7bcb1226
7 changed files with 36 additions and 22 deletions

View File

@@ -0,0 +1,7 @@
final class Platform {
static bool get isWindows => false;
static bool get isLinux => false;
static bool get isMacOS => false;
static bool get isAndroid => false;
static bool get isIOS => false;
}

View File

@@ -0,0 +1 @@
export 'get_jar_other.dart' if (dart.library.html) 'get_jar_none.dart';

View File

@@ -0,0 +1,3 @@
Future<String> getJarPath() {
throw UnimplementedError();
}

View File

@@ -0,0 +1,21 @@
import 'dart:io';
import '../utils.dart';
import '../globals.dart';
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
Future<String> getJarPath() async {
if (isWindows || isLinux) {
try {
final p = await platformPath.getCurrentExe();
if (p != null) {
return path.join(path.dirname(p), "cookies");
}
} catch (e) {
// Do nothing
}
}
final Directory appDocDir = await getApplicationDocumentsDirectory();
final String appDocPath = appDocDir.path;
return '$appDocPath/.eh-cookies/';
}