handle default git+workdir in phar files
authorChristian Weiske <cweiske@cweiske.de>
Fri, 4 Jul 2014 05:34:10 +0000 (07:34 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 4 Jul 2014 05:34:10 +0000 (07:34 +0200)
data/config.default.php

index eb98efd7076a12d5fe45736cb1bc3b5216d20c0f..22bbc4a7eba573d52b94a794ac6011210a9c2fca 100644 (file)
@@ -1,8 +1,16 @@
 <?php
+$pharFile = \Phar::running();
+if ($pharFile == '') {
+    $phorkieDir = __DIR__ . '/../';
+} else {
+    //remove phar:// from the path
+    $phorkieDir = dirname(substr($pharFile, 7)) . '/';
+}
+
 $GLOBALS['phorkie']['cfg'] = array(
     'debug'         => false,
-    'gitdir'        => __DIR__ . '/../repos/git/',
-    'workdir'       => __DIR__ . '/../repos/work/',
+    'gitdir'        => $phorkieDir . 'repos/git/',
+    'workdir'       => $phorkieDir . 'repos/work/',
     'tpl'           => __DIR__ . '/templates/',
     'baseurl'       => null,
     'avatars'       => true,