Subversion Repositories fastphp

Compare Revisions

Regard whitespace Rev 49 → Rev 48

/trunk/FastPHPUtils.pas
8,6 → 8,7
const
FASTPHP_GOTO_URI_PREFIX = 'fastphp://editor/gotoline/';
 
function FastPHPConfig: TMemIniFile;
function GetPHPExe: string;
function RunPHPScript(APHPFileName: string; lint: boolean=false; inConsole: boolean=False): string;
function ParseCHM(const chmFile: TFileName): boolean;
16,13 → 17,25
implementation
 
uses
Functions, FastPHPConfig;
Functions;
 
var
__FastPHPConfig: TMemIniFile;
 
function FastPHPConfig: TMemIniFile;
begin
if not Assigned(__FastPHPConfig) then
begin
__FastPHPConfig := TMemIniFile.Create(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + 'FastPHP.ini');
end;
result := __FastPHPConfig;
end;
 
function GetPHPExe: string;
var
od: TOpenDialog;
begin
result := TFastPHPConfig.PhpInterpreter;
result := FastPHPConfig.ReadString('Paths', 'PHPInterpreter', '');
if not FileExists(result) then
begin
od := TOpenDialog.Create(nil);
31,7 → 44,7
od.FileName := 'php.exe';
od.Filter := 'Executable file (*.exe)|*.exe';
od.Options := [ofReadOnly, ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing];
od.Title := 'Please choose your PHP interpreter (php.exe)';
od.Title := 'Please chose your PHP interpreter (php.exe)';
 
if not od.Execute then exit;
if not FileExists(od.FileName) then exit;
42,11 → 55,12
 
if not IsValidPHPExe(result) then
begin
MessageDlg('This is not a valid PHP executable.', mtError, [mbOk], 0);
ShowMessage('This is not a valid PHP executable.');
exit;
end;
 
TFastPHPConfig.PhpInterpreter := result;
FastPHPConfig.WriteString('Paths', 'PHPInterpreter', result);
FastPHPConfig.UpdateFile;
end;
end;
 
217,4 → 231,11
(Pos('PHP_SELF', cont) >= 0);
end;
 
initialization
finalization
if Assigned(__FastPHPConfig) then
begin
__FastPHPConfig.UpdateFile;
FreeAndNil(__FastPHPConfig);
end;
end.