Skip to content

Commit 5da73c3

Browse files
committed
change the linux library path resolver
1 parent 736ccb8 commit 5da73c3

File tree

3 files changed

+5
-23
lines changed

3 files changed

+5
-23
lines changed

.idea/workspace.xml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dargon2_flutter/dargon2_flutter_desktop/lib/src/native/desktop_lib_loader.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DesktopLibLoader implements LibLoader {
3030
/// of a Flutter plugin as macOS is already handled with the .process()
3131
@override
3232
String getPath() =>
33-
Platform.isLinux ? Platform.environment['LIBFOO_PATH'] ?? "libargon2.so"
34-
: "argon2.dll";
33+
Platform.isLinux ? "${File(Platform.resolvedExecutable).parent.path}"
34+
"/lib/shared_library/libargon2.so" : "argon2.dll";
3535

3636
}

dargon2_flutter/dargon2_flutter_desktop/linux/dargon2_flutter_desktop_plugin.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,11 @@
55
#include <sys/utsname.h>
66

77
#include <cstring>
8-
#include <glib.h>
9-
108

119
#define DARGON2_FLUTTER_DESKTOP_PLUGIN(obj) \
1210
(G_TYPE_CHECK_INSTANCE_CAST((obj), dargon2_flutter_desktop_plugin_get_type(), \
1311
Dargon2FlutterDesktopPlugin))
1412

15-
static gchar* get_executable_dir() {
16-
g_autoptr(GError) error = nullptr;
17-
g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", &error);
18-
if (exe_path == nullptr) {
19-
g_critical("Failed to determine location of executable: %s",
20-
error->message);
21-
return nullptr;
22-
}
23-
24-
return g_path_get_dirname(exe_path);
25-
}
26-
2713
struct _Dargon2FlutterDesktopPlugin {
2814
GObject parent_instance;
2915
};
@@ -71,11 +57,6 @@ void dargon2_flutter_desktop_plugin_register_with_registrar(FlPluginRegistrar* r
7157
Dargon2FlutterDesktopPlugin* plugin = DARGON2_FLUTTER_DESKTOP_PLUGIN(
7258
g_object_new(dargon2_flutter_desktop_plugin_get_type(), nullptr));
7359

74-
g_autofree gchar* executable_dir = get_executable_dir();
75-
g_autofree gchar* libfoo_path =
76-
g_build_filename(self_exe, "lib", "libfoo.so", nullptr);
77-
setenv("LIBFOO_PATH", libfoo_path, 0);
78-
7960
g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
8061
g_autoptr(FlMethodChannel) channel =
8162
fl_method_channel_new(fl_plugin_registrar_get_messenger(registrar),

0 commit comments

Comments
 (0)