unit gitupdateunit; {$mode objfpc}{$H+} interface uses Classes, SysUtils; implementation uses process, systemunit, lowlevelunit, refreshExecutableUnit; var updated: boolean; myDir,baseDir, output: string; args: array of string; initialization updated:=false; myDir:=extractFilePath(paramstr(0)); baseDir:=extractFilePath(leftStr(myDir,length(myDir)-1)); output:=''; setlength(args,2); args[0]:='pull'; args[1]:='--all'; if runCommandInDir(myDir,'git',args,output) then begin updated:=updated or (output<>'Already up-to-date.'#10); if runCommandInDir(baseDir+'units','git',args,output) then begin updated:=updated or (output<>'Already up-to-date.'#10); if updated then refreshExecutable(myDir); end; end; setlength(args,0); end.