From 1d1337a6761c8dbbf842583eaca5f6a54937dd4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20R?= Date: Tue, 1 Mar 2016 21:20:08 -0430 Subject: [PATCH] Fix paths not working when using the phar archive --- emulator/emulator.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/emulator/emulator.php b/emulator/emulator.php index 8ceeb3b..4a00cba 100644 --- a/emulator/emulator.php +++ b/emulator/emulator.php @@ -8,7 +8,12 @@ require 'util.php'; define('VERBOSE', false); -define('EMU_PATH', dirname(__DIR__)); + +if(\Phar::running()) { + define('EMU_PATH', dirname(\Phar::running(false)) . DIRECTORY_SEPARATOR); +}else { + define('EMU_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR); +} if('Linux' == PHP_OS) { echo "☉ ". "\033[34;34mE\033[0m" . "\033[33;33mm\033[0m" . "\033[1;31mu\033[0m"; @@ -27,7 +32,7 @@ exit; } -$configFileName = __DIR__ . DIRECTORY_SEPARATOR . $argv[1]; +$configFileName = EMU_PATH . $argv[1]; $port = $argv[2]; echo '* Reading configuration file ' . basename($configFileName) . '...' . PHP_EOL;