some changes

This commit is contained in:
Felix Geyer 2004-08-13 15:34:50 +00:00
parent 27bb44a7fe
commit 0181a491d8
2 changed files with 18 additions and 13 deletions

View File

@ -42,13 +42,13 @@ var
sr: TSearchRec; sr: TSearchRec;
i: Word; i: Word;
begin begin
WriteLn('AMXXSC compile.exe'); WriteLn('//AMXXSC compile.exe');
WriteLn(' by the AMX Mod X Dev Team'); WriteLn('// by the AMX Mod X Dev Team');
WriteLn; WriteLn;
if not FileExists(ExtractFilePath(ParamStr(0))+'amxxsc.exe') then if not FileExists(ExtractFilePath(ParamStr(0))+'amxxsc.exe') then
begin begin
WriteLn('Could not find amxxsc.exe'); WriteLn('// Could not find amxxsc.exe');
AppExit; AppExit;
end; end;
@ -64,7 +64,7 @@ begin
else else
begin begin
WriteLn; WriteLn;
WriteLn('File not found.'); WriteLn('// File not found.');
end; end;
end; end;
end end
@ -78,7 +78,7 @@ begin
end end
else else
begin begin
WriteLn('No file found.'); WriteLn('// No file found.');
end; end;
FindClose(sr); FindClose(sr);
end; end;

View File

@ -65,23 +65,28 @@ begin
if (FilePath='') then if (FilePath='') then
FilePath := ExtractFilePath(ParamStr(0)); FilePath := ExtractFilePath(ParamStr(0));
if FileExists(Compiled) and ( GetAgeFromDat(FileName)=FileAge(Name) ) then
Exit;
WriteLn; WriteLn;
WriteLn('//// '+ExtractFileName(FileName)); WriteLn('//// '+ExtractFileName(FileName));
if FileExists(Compiled) and ( GetAgeFromDat(FileName)=FileAge(Name) ) then
begin
WriteLn('// Already compiled.');
WriteLn('// ----------------------------------------');
Exit;
end;
Output := TStringList.Create; Output := TStringList.Create;
try try
cStart := GetTickCount; cStart := GetTickCount;
if not GetConsoleOutput(ExtractFilePath(ParamStr(0))+'amxxsc.exe "'+FilePath+FileName+'" "-o'+Compiled+'"',Output) then if not GetConsoleOutput(ExtractFilePath(ParamStr(0))+'amxxsc.exe "'+FilePath+FileName+'" "-o'+Compiled+'"',Output) then
begin begin
WriteLn('Internal error.'); WriteLn('// Internal error.');
AppExit; AppExit;
end; end;
cEnd := GetTickCount; cEnd := GetTickCount;
for i := 2 to (Output.Count-1) do for i := 3 to (Output.Count-1) do
begin begin
WriteLn('// '+Output.Strings[i]); WriteLn('// '+Output.Strings[i]);
end; end;
@ -91,7 +96,7 @@ begin
WriteLn('// ----------------------------------------'); WriteLn('// ----------------------------------------');
Output.Free; Output.Free;
except except
WriteLn('Internal error.'); WriteLn('// Internal error.');
AppExit; AppExit;
end; end;
@ -135,7 +140,7 @@ begin
FillChar(SecurityAttr, SizeOf(TSecurityAttributes), 0); FillChar(SecurityAttr, SizeOf(TSecurityAttributes), 0);
SecurityAttr.nLength := SizeOf(SecurityAttr); SecurityAttr.nLength := SizeOf(SecurityAttr);
SecurityAttr.bInheritHandle := true; SecurityAttr.bInheritHandle := True;
SecurityAttr.lpSecurityDescriptor := nil; SecurityAttr.lpSecurityDescriptor := nil;
CreatePipe(PipeOutputRead, PipeOutputWrite, @SecurityAttr, 0); CreatePipe(PipeOutputRead, PipeOutputWrite, @SecurityAttr, 0);
@ -158,7 +163,7 @@ begin
Stream := TMemoryStream.Create; Stream := TMemoryStream.Create;
try try
while true do begin while True do begin
Succeed := ReadFile(PipeOutputRead, Buffer, 255, NumberOfBytesRead, nil); Succeed := ReadFile(PipeOutputRead, Buffer, 255, NumberOfBytesRead, nil);
if not Succeed then Break; if not Succeed then Break;
Stream.Write(Buffer, NumberOfBytesRead); Stream.Write(Buffer, NumberOfBytesRead);