mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-05-10 00:44:12 +08:00
js support function getApplicationSupportDirectory() (#433)
This commit is contained in:
@@ -17,12 +17,17 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_js/flutter_js.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:proxypin/network/util/logger.dart';
|
||||
|
||||
/// FileBridge for file operation
|
||||
/// @Author: Hongen Wang
|
||||
class FileBridge {
|
||||
static const String code = '''
|
||||
function getApplicationSupportDirectory() {
|
||||
return sendMessage('getApplicationSupportDirectory', JSON.stringify(''));
|
||||
}
|
||||
|
||||
function File(path) {
|
||||
return {
|
||||
path: path,
|
||||
@@ -92,6 +97,10 @@ class FileBridge {
|
||||
logger.e('registerFile error: ${result.stringResult}');
|
||||
}
|
||||
|
||||
flutterJs.onMessage('getApplicationSupportDirectory', (args) {
|
||||
return getApplicationSupportDirectory().then((dir) => dir.path);
|
||||
});
|
||||
|
||||
flutterJs.onMessage('file.readAsString', (path) {
|
||||
return File(path).readAsString();
|
||||
});
|
||||
|
||||
@@ -14,8 +14,6 @@ Compression=lzma
|
||||
SolidCompression=yes
|
||||
SetupIconFile={{SETUP_ICON_FILE}}
|
||||
WizardStyle=modern
|
||||
ArchitecturesAllowed=x64
|
||||
ArchitecturesInstallIn64BitMode=x64
|
||||
CloseApplications=force
|
||||
|
||||
[Languages]
|
||||
|
||||
Reference in New Issue
Block a user