From 4f3b77f9f35cb4226fd0b4bbb9578ba4e1f4f7a8 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Sat, 19 Sep 2026 18:41:09 -0400 Subject: [PATCH] set env for gomuks Fixes #62 --- .gitmodules | 4 ++-- gomuks | 2 +- lib/controllers/client.dart | 22 +++++++++++++--------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.gitmodules b/.gitmodules index 145276a..0cecb0c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "gomuks"] path = gomuks - url = https://github.com/gomuks/gomuks - branch = main + url = https://github.com/Henry-Hiles/gomuks + branch = quad/chore/remove-root-set diff --git a/gomuks b/gomuks index 0e06c7b..9e45ee4 160000 --- a/gomuks +++ b/gomuks @@ -1 +1 @@ -Subproject commit 0e06c7b74f96d3e29a8101893ca1921d13a90573 +Subproject commit 9e45ee426cc8be0bfada269f4abc4957c30e994e diff --git a/lib/controllers/client.dart b/lib/controllers/client.dart index a535b1e..ee4e0a0 100644 --- a/lib/controllers/client.dart +++ b/lib/controllers/client.dart @@ -54,8 +54,19 @@ import "package:path_provider/path_provider.dart"; class ClientController extends AsyncNotifier { @override Future build() async { - final path = "${(await getApplicationSupportDirectory()).path}/gomuks"; - final handle = await init(path); + if (Platform.isAndroid || Platform.isIOS) { + final env = { + "GOMUKS_ROOT": (await getApplicationSupportDirectory()).path, + "GOMUKS_CACHE_HOME": (await getApplicationCacheDirectory()).path, + }; + for (final MapEntry(:key, :value) in env.entries) { + GomuksSetEnv( + key.toNativeUtf8().cast(), + value.toNativeUtf8().cast(), + ); + } + } + final handle = await Isolate.run(GomuksInit); final callable = NativeCallable< @@ -152,13 +163,6 @@ class ClientController extends AsyncNotifier { throw Exception("GomuksStart returned error code $errorCode"); } - Future init(String path) => Isolate.run( - () => GomuksInit( - ((Platform.isAndroid || Platform.isIOS) ? path.toNativeUtf8() : nullptr) - .cast(), - ), - ); - Future callGomuksMethod( Map data, FutureOr Function(int handle, GomuksBorrowedBuffer data)