aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-04-03 14:10:17 +0200
committerMarvin W <git@larma.de>2017-04-03 15:05:39 +0200
commit8248cfcbb25dc14c81bd9673c8b3642ce98ea495 (patch)
tree21ec03ad902b001c3e84c428a31e10f62ad18614 /libdino/src
parent22adbd38dca0868f0e10754314a3859bba0a7d87 (diff)
downloaddino-8248cfcbb25dc14c81bd9673c8b3642ce98ea495.tar.gz
dino-8248cfcbb25dc14c81bd9673c8b3642ce98ea495.zip
Make FHS compliant, split RPMs, fix compilation on older GCCs
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/plugin/loader.vala25
1 files changed, 13 insertions, 12 deletions
diff --git a/libdino/src/plugin/loader.vala b/libdino/src/plugin/loader.vala
index 7497311d..d38a0ec5 100644
--- a/libdino/src/plugin/loader.vala
+++ b/libdino/src/plugin/loader.vala
@@ -1,5 +1,8 @@
namespace Dino.Plugins {
+private extern const string SYSTEM_LIBDIR_NAME;
+private extern const string SYSTEM_PLUGIN_DIR;
+
private class Info : Object {
public Module module;
public Type gtype;
@@ -19,30 +22,28 @@ public class Loader : Object {
private Info[] infos = new Info[0];
public Loader(string? exec_str = null) {
- search_paths += Application.get_storage_dir();
+ if (Environment.get_variable("DINO_PLUGIN_DIR") != null) {
+ search_paths += Environment.get_variable("DINO_PLUGIN_DIR");
+ }
+ search_paths += Path.build_filename(Environment.get_home_dir(), ".local", "lib", "dino", "plugins");
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);
}
- // TODO: more robust is detection if installed
- if (!exec_path.has_prefix("/usr/")) {
- search_paths += Path.get_dirname(exec_path);
+ if (Path.get_dirname(exec_path).contains("dino") || Path.get_dirname(exec_path) == "." || Path.get_dirname(exec_path).contains("build")) {
+ search_paths += Path.build_filename(Path.get_dirname(exec_path), "plugins");
}
- }
- 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");
+ search_paths += Path.build_filename(Path.get_dirname(Path.get_dirname(exec_path)), SYSTEM_LIBDIR_NAME, "dino", "plugins");
}
}
+ search_paths += SYSTEM_PLUGIN_DIR;
}
public void print_search_paths() {
foreach (string prefix in search_paths) {
- print(@"$prefix/plugins\n");
+ print(@"$prefix\n");
}
}
@@ -54,7 +55,7 @@ public class Loader : Object {
Module module = null;
string path = "";
foreach (string prefix in search_paths) {
- path = Path.build_filename(prefix, "plugins", name);
+ path = Path.build_filename(prefix, name);
module = Module.open (path, ModuleFlags.BIND_LAZY);
if (module != null) break;
}