From e6f89f8751e6e65d4a36a125cc3fe398098ba504 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Thu, 23 Mar 2017 17:10:45 +0100 Subject: New CMake - add install and uninstall targets - compatibility for systems without pkg-config --- libdino/src/plugin/loader.vala | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'libdino/src/plugin') diff --git a/libdino/src/plugin/loader.vala b/libdino/src/plugin/loader.vala index 42d7fa9b..8c633ef1 100644 --- a/libdino/src/plugin/loader.vala +++ b/libdino/src/plugin/loader.vala @@ -20,18 +20,30 @@ public class Loader : Object { public Loader(string? exec_str = null) { search_paths += Application.get_storage_dir(); - if (exec_str != null) { - string exec_path = exec_str; + string? exec_path = exec_str; + if (exec_path != null) { if (!exec_path.contains(Path.DIR_SEPARATOR_S)) { exec_path = Environment.find_program_in_path(exec_str); } - if (exec_path[0:5] != "/usr") { + // TODO: more robust is detection if installed + if (!exec_path.has_prefix("/usr/")) { search_paths += Path.get_dirname(exec_path); } } foreach (string dir in Environment.get_system_data_dirs()) { search_paths += Path.build_filename(dir, "dino"); } + if (exec_path != null) { + if (Path.get_basename(Path.get_dirname(exec_path)) == "bin") { + search_paths += Path.build_filename(Path.get_dirname(Path.get_dirname(exec_path)), "share", "dino"); + } + } + } + + public void print_search_paths() { + foreach (string prefix in search_paths) { + print(@"$prefix/plugins\n"); + } } public RootInterface load(string name, Dino.Application app) throws Error { -- cgit v1.2.3-54-g00ecf