File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -103,9 +103,15 @@ public function build($filename, $stub) {
103103 $ phar ->setSignatureAlgorithm ($ this ->selectSignatureType ());
104104 }
105105
106- $ basedir = $ this ->basedir ? $ this -> basedir : $ this ->directories [0 ];
106+ $ basedir = $ this ->basedir ?: $ this ->directories [0 ];
107107 foreach ($ this ->directories as $ directory ) {
108- $ phar ->buildFromIterator ($ this ->scanner ->__invoke ($ directory ), $ basedir );
108+ if (file_exists ("$ directory/ " )) {
109+ $ phar ->buildFromIterator ($ this ->scanner ->__invoke ($ directory ), $ basedir );
110+ } else {
111+ $ comparator = new PathComparator (array ($ basedir , $ directory ));
112+ $ localName = str_replace ($ comparator ->getCommonBase ().'/ ' , '' , $ directory );
113+ $ phar ->addFile ($ directory , $ localName );
114+ }
109115 }
110116
111117 if ($ this ->compression !== \Phar::NONE ) {
You can’t perform that action at this time.
0 commit comments