Fix examples_dir location when not yet installed
authorThomas Perl <m@thp.io>
Mon, 11 Mar 2013 12:39:34 +0000 (11 13:39 +0100)
committerThomas Perl <m@thp.io>
Mon, 11 Mar 2013 12:39:34 +0000 (11 13:39 +0100)
urlwatch

index 6c696e2..8fca850 100755 (executable)
--- a/urlwatch
+++ b/urlwatch
@@ -64,11 +64,14 @@ hooks_py = os.path.join(scripts_dir, 'hooks.py')
 # Check if we are installed in the system already
 (prefix, bindir) = os.path.split(os.path.dirname(os.path.abspath(sys.argv[0])))
 
-if bindir != 'bin':
+if bindir == 'bin':
+    # Installed system-wide
+    examples_dir = os.path.join(prefix, 'share', pkgname, 'examples')
+else:
     # Assume we are not yet installed
     sys.path.insert(0, os.path.join(prefix, bindir, 'lib'))
+    examples_dir = os.path.join(prefix, bindir, 'share', pkgname, 'examples')
 
-examples_dir = os.path.join(prefix, 'share', pkgname, 'examples')
 urls_txt_example = os.path.join(examples_dir, 'urls.txt.example')
 hooks_py_example = os.path.join(examples_dir, 'hooks.py.example')