[shotwell] Rework in-tree logic



commit 5f60d0e709440b647db31e3d29bdec91b46dc919
Author: Jens Georg <mail jensge org>
Date:   Wed May 4 22:24:05 2016 +0200

    Rework in-tree logic
    
    Instead of doing prefix magic, check whether there is a directory called "ui"
    next to the executable and assume we run in-tree.
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747374

 src/util/system.vala |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/util/system.vala b/src/util/system.vala
index faaffff..bd94fb0 100644
--- a/src/util/system.vala
+++ b/src/util/system.vala
@@ -6,16 +6,14 @@
 
 // Return the directory in which Shotwell is installed, or null if uninstalled.
 File? get_sys_install_dir(File exec_dir) {
-    // guard against exec_dir being a symlink
-    File exec_dir1 = exec_dir;
-    try {
-        exec_dir1 = File.new_for_path(
-            FileUtils.read_link("/" + FileUtils.read_link(exec_dir.get_path())));
-    } catch (FileError e) {
-        // exec_dir is not a symlink
+    // Assume that if the ui folder lives next to the binary, we runn in-tree
+    File child = exec_dir.get_child("ui");
+
+    if (!FileUtils.test(child.get_path(), FileTest.IS_DIR | FileTest.EXISTS)) {
+        return File.new_for_path(Resources.PREFIX);
     }
-    File prefix_dir = File.new_for_path(Resources.PREFIX);
-    return exec_dir1.has_prefix(prefix_dir) ? prefix_dir : null;
+
+    return null;
 }
 
 string get_nautilus_install_location() {


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