woodemi / quick_usb

A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter
BSD 3-Clause "New" or "Revised" License
43 stars 30 forks source link

Refactor linux so loading #22

Closed Sunbreak closed 3 years ago

Sunbreak commented 3 years ago

Signed-off-by: wangkun wangkun@woodemi.com

Sunbreak commented 3 years ago

Workaround 1

+  g_autofree gchar* executable_dir = get_executable_dir();
+  g_autofree gchar* libfoo_path =
+      g_build_filename(self_exe, "lib", "libfoo.so", nullptr);
+  setenv("LIBFOO_PATH", libfoo_path, 0);
DynamicLibrary.open(Platform.environment['LIBFOO_PATH'])

Ref

Workaround 2

DynamicLibrary.open('${File(Platform.resolvedExecutable).parent.path}/lib/shared_library/lib.so')

Ref