File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed
Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,13 @@ public function isWindows($os = PHP_OS): bool
1919
2020 return true ;
2121 }
22+
23+ public function isMacOs ($ os = PHP_OS ): bool
24+ {
25+ if (\strtoupper (\substr ($ os , 0 , 3 )) !== 'DAR ' ) {
26+ return false ;
27+ }
28+
29+ return true ;
30+ }
2231}
Original file line number Diff line number Diff line change @@ -29,10 +29,13 @@ public function __construct(Archive $archive)
2929
3030 public function getTreeForSrc (string $ directory ): string
3131 {
32- \exec (
33- 'tree -aL 1 --dirsfirst ' . \escapeshellarg ($ directory ) . ' --gitignore -I .git 2>&1 ' ,
34- $ output
35- );
32+ $ command = 'tree -aL 1 --dirsfirst ' . \escapeshellarg ($ directory ) . ' -I .git 2>&1 ' ;
33+
34+ if ((new OsHelper ())->isMacOs ()) {
35+ $ command = 'tree -aL 1 --dirsfirst ' . \escapeshellarg ($ directory ) . ' --gitignore -I .git 2>&1 ' ;
36+ }
37+
38+ \exec ($ command , $ output );
3639
3740 $ output [0 ] = '. ' ;
3841
@@ -43,10 +46,13 @@ public function getTreeForDistPackage(string $directory): string
4346 {
4447 $ this ->archive ->createArchive ();
4548
46- \exec (
47- 'tar --list --exclude="*/*" --file ' . \escapeshellarg ($ this ->archive ->getFilename ()) . ' | tree -aL 1 --dirsfirst --fromfile . 2>&1 ' ,
48- $ output
49- );
49+ $ command = 'tar --list --exclude="*/*" --file ' . \escapeshellarg ($ this ->archive ->getFilename ()) . ' | tree -aL 1 --dirsfirst --fromfile . 2>&1 ' ;
50+
51+ if ((new OsHelper ())->isMacOs ()) {
52+ $ command = 'tar --list --file ' . \escapeshellarg ($ this ->archive ->getFilename ()) . ' | tree -aL 1 --dirsfirst --fromfile . 2>&1 ' ;
53+ }
54+
55+ \exec ($ command , $ output );
5056
5157 $ this ->archive ->removeArchive ();
5258
You can’t perform that action at this time.
0 commit comments