diff --git a/bin/generate_default_stub b/bin/generate_default_stub old mode 100644 new mode 100755 diff --git a/src/Box.php b/src/Box.php index 524ea4c20..9e15dd116 100644 --- a/src/Box.php +++ b/src/Box.php @@ -15,8 +15,8 @@ namespace KevinGH\Box; use Assert\Assertion; +use const DIRECTORY_SEPARATOR; use Humbug\PhpScoper\Console\Configuration as PhpScoperConfiguration; -use function is_file; use KevinGH\Box\Compactor\PhpScoper; use KevinGH\Box\Composer\ComposerOrchestrator; use Phar; @@ -26,6 +26,7 @@ use function Amp\Promise\wait; use function array_map; use function chdir; +use function is_file; use function KevinGH\Box\FileSystem\copy; use function KevinGH\Box\FileSystem\dump_file; use function KevinGH\Box\FileSystem\file_contents; @@ -393,10 +394,13 @@ function (string $file): bool { ) ); + $sourceMainScript = self::DEBUG_DIR.DIRECTORY_SEPARATOR.$mainScript; + $targetMainScript = $tmp.DIRECTORY_SEPARATOR.$mainScript; + if (is_file($mainScript)) { - copy($mainScript, $tmp . '/' . $mainScript); + copy($sourceMainScript, $targetMainScript); } else { - rename($mainScript, $tmp . '/' . $mainScript); + rename($sourceMainScript, $targetMainScript); } rename($tmp, self::DEBUG_DIR, true);