diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-06-05 04:23:52 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-06-05 04:23:52 +0200 |
commit | bec5f87053759705fb77bae1aa378f2666c7d153 (patch) | |
tree | bd955b9777aa39b207fa161edf19a6609f822909 /src/util/system.vala | |
parent | 1c99a41a296cda6647edc32437a813f6923cb1d0 (diff) | |
parent | 4e10e30c2f99d552239871aa1b27a08a6c18f1a4 (diff) |
Merge tag 'upstream/0.23.1'
Upstream version 0.23.1
Diffstat (limited to 'src/util/system.vala')
-rw-r--r-- | src/util/system.vala | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/util/system.vala b/src/util/system.vala index 8e5a07f..f2436e4 100644 --- a/src/util/system.vala +++ b/src/util/system.vala @@ -1,26 +1,19 @@ -/* Copyright 2009-2015 Yorba Foundation +/* Copyright 2016 Software Freedom Conservancy Inc. * * This software is licensed under the GNU LGPL (version 2.1 or later). * See the COPYING file in this distribution. */ -int number_of_processors() { - int n = (int) ExtendedPosix.sysconf(ExtendedPosix.ConfName._SC_NPROCESSORS_ONLN); - return n <= 0 ? 1 : n; -} - // 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() { @@ -35,6 +28,3 @@ void show_file_in_nautilus(string filename) throws Error { GLib.Process.spawn_command_line_async(get_nautilus_install_location() + " " + filename); } -int posix_wexitstatus(int status) { - return (((status) & 0xff00) >> 8); -} |