chiark / gitweb /
Support calling of 'fdroid init' from other places
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 30 Jun 2014 17:38:38 +0000 (19:38 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 30 Jun 2014 17:38:38 +0000 (19:38 +0200)
e.g. from a symlink to fdroid or from a script. Also more reliable in other
cases where argv[0] is not what we want.

fdroidserver/init.py

index f55549ab4bb73591e47b65cbe8588201dc66917a..3a40eada711a563fb7a4d2c970beeb84878b79e1 100644 (file)
@@ -112,7 +112,7 @@ def main():
     (options, args) = parser.parse_args()
 
     # find root install prefix
-    tmp = os.path.dirname(sys.argv[0])
+    tmp = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
     if os.path.basename(tmp) == 'bin':
         prefix = os.path.dirname(tmp)
         examplesdir = prefix + '/share/doc/fdroidserver/examples'