[shotwell] Fix running from meson build dir



commit 5347425b43784ba85152a642cef3db50a788e689
Author: Jens Georg <mail jensge org>
Date:   Fri May 26 09:50:26 2017 +0200

    Fix running from meson build dir

 src/AppDirs.vala     |   13 +++++++++++--
 src/util/system.vala |    5 +++++
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/AppDirs.vala b/src/AppDirs.vala
index 0c69270..ffea859 100644
--- a/src/AppDirs.vala
+++ b/src/AppDirs.vala
@@ -260,9 +260,18 @@ class AppDirs {
     
     public static File get_lib_dir() {
         File? install_dir = get_install_dir();
+
+        // Running from source tree
+        if (install_dir == null) {
+            // Meson build
+            if (get_exec_dir().get_path().has_suffix("src")) {
+                return get_exec_dir().get_parent();
+            }
+
+            return get_exec_dir();
+        }
         
-        return (install_dir != null) ? install_dir.get_child(Resources.LIB).get_child("shotwell")
-            : get_exec_dir();
+        return install_dir.get_child(Resources.LIB).get_child("shotwell");
     }
     
     public static File get_system_plugins_dir() {
diff --git a/src/util/system.vala b/src/util/system.vala
index f2436e4..38abf1e 100644
--- a/src/util/system.vala
+++ b/src/util/system.vala
@@ -10,6 +10,11 @@ File? get_sys_install_dir(File exec_dir) {
     File child = exec_dir.get_child("ui");
 
     if (!FileUtils.test(child.get_path(), FileTest.IS_DIR | FileTest.EXISTS)) {
+        // If not, let's see if we are in "src" dir - meson out-of-tree build
+        if (exec_dir.get_basename() == "src") {
+            return null;
+        }
+
         return File.new_for_path(Resources.PREFIX);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]