aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/plugin/loader.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-03-23 17:10:45 +0100
committerMarvin W <git@larma.de>2017-03-23 17:16:08 +0100
commite6f89f8751e6e65d4a36a125cc3fe398098ba504 (patch)
tree54acce89355ee07b05db761d6d0dad8dad4e0f36 /libdino/src/plugin/loader.vala
parentef0483765a0fd567f25b1f0af6df04e8973e5624 (diff)
downloaddino-e6f89f8751e6e65d4a36a125cc3fe398098ba504.tar.gz
dino-e6f89f8751e6e65d4a36a125cc3fe398098ba504.zip
New CMake
- add install and uninstall targets - compatibility for systems without pkg-config
Diffstat (limited to 'libdino/src/plugin/loader.vala')
-rw-r--r--libdino/src/plugin/loader.vala18
1 files changed, 15 insertions, 3 deletions
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 {