mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Fix _Namespace not defined
This commit is contained in:
7
lib/platform/fake_io.dart
Normal file
7
lib/platform/fake_io.dart
Normal 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;
|
||||
}
|
||||
1
lib/platform/get_jar.dart
Normal file
1
lib/platform/get_jar.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'get_jar_other.dart' if (dart.library.html) 'get_jar_none.dart';
|
||||
3
lib/platform/get_jar_none.dart
Normal file
3
lib/platform/get_jar_none.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
Future<String> getJarPath() {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
21
lib/platform/get_jar_other.dart
Normal file
21
lib/platform/get_jar_other.dart
Normal 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/';
|
||||
}
|
||||
Reference in New Issue
Block a user