File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/Ubiquity/devtools/utils Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ public static function writeFile($filename,$data){
2222 }
2323
2424 public static function xcopy ($ source , $ dest , $ permissions = 0755 ){
25- $ path = pathinfo ($ dest );
26- if (!file_exists ($ path ['dirname ' ])) {
27- mkdir ($ path ['dirname ' ], 0777 , true );
28- }
25+ $ path = pathinfo ($ dest );
26+ if (!file_exists ($ path ['dirname ' ])) {
27+ mkdir ($ path ['dirname ' ], 0777 , true );
28+ }
2929 if (is_link ($ source )) {
3030 return symlink (readlink ($ source ), $ dest );
3131 }
@@ -69,4 +69,16 @@ public static function cleanPathname($path){
6969 }
7070 return \realpath ($ path );
7171 }
72+
73+ public static function systemCommandExists ($ command ) :bool {
74+ $ windows = \strpos (PHP_OS , 'WIN ' ) === 0 ;
75+ $ test = $ windows ? 'where ' : 'command -v ' ;
76+ $ commands =explode ("\n" ,\trim (\shell_exec ("$ test $ command " )));
77+ foreach ($ commands as $ cmd ){
78+ if ($ cmd !=null && \file_exists ($ cmd )){
79+ return true ;
80+ }
81+ }
82+ return false ;
83+ }
7284}
You can’t perform that action at this time.
0 commit comments