Skip to content

Commit

Permalink
fix install error
Browse files Browse the repository at this point in the history
  • Loading branch information
Spishous committed May 3, 2022
1 parent 114c118 commit 70a5416
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions spish.pha
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?php
const GIT = "Spishous/SpishCLI";
const CLI = "spish";
const VERSION = "1.1.0";
const VERSION = "1.1.1";
define("FOLDER", getcwd());
define("CLIDIR", dirname(__FILE__));
define("ARGV", $argv);
Expand Down Expand Up @@ -127,24 +127,30 @@ abstract class command extends gitInfo{
$b='reg query '.$a;
$handle = popen($b, 'r');
usleep(100);
$r = fread($handle, 2096);
$r = fread($handle,10000);
usleep(500);
pclose($handle);
$sysPath=trim(explode(" ",$r)[3]??"");
if($sysPath[strlen($sysPath)-1]!==";") $sysPath .= ";";
pclose($handle);
if(!str_contains($sysPath, CLIDIR."\;")&&!str_contains(exec('echo %path%'), CLIDIR."\;")){
$sysPath.=CLIDIR."\;";
if($sysPath[strlen($sysPath)-1]==";"){
exec('reg add '.$a.' /d "'.$sysPath.'" /f');
exec('setx /m PATH "'.$sysPath.'"');
exec('set path="'.$sysPath.'"');
echo "Command CLI installed\n";
system("pause");
return true;
}
}
echo "Command CLI \"".CLI."\" already installed\n";
return false;
try{
if($sysPath[strlen($sysPath)-1]!==";") $sysPath .= ";";

if(!str_contains($sysPath, CLIDIR."\;")&&!str_contains(exec('echo %path%'), CLIDIR."\;")){
$sysPath.=CLIDIR."\;";
if($sysPath[strlen($sysPath)-1]==";"){
exec('reg add '.$a.' /d "'.$sysPath.'" /f');
exec('setx /m PATH "'.$sysPath.'"');
exec('set path="'.$sysPath.'"');
echo "Command CLI installed\n";
system("pause");
return true;
}
}
return false;
}catch(Error $e){
return $this->iniSystemPath();
}
}


public function uninstall(){
$a='"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path';
Expand Down

0 comments on commit 70a5416

Please sign in to comment.