MG: added file checks

git-svn-id: trunk@3378 -
This commit is contained in:
lazarus 2002-09-30 19:19:01 +00:00
parent fc096bf64a
commit 767b978afa

View File

@ -89,7 +89,21 @@ begin
if ParamCount<2 then begin
writeln('Usage: ',ExtractFileName(ParamStr(0))
,' resourcefilename filename1 [filename2 ... filenameN]');
end else begin
exit;
end;
// check that all resources exists and are not the destination file
for a:=2 to ParamCount do begin
if not FileExists(ParamStr(a)) then begin
writeln('ERROR: file not found: ',ParamStr(a));
exit;
end;
if ExpandFileName(ParamStr(a))=ExpandFileName(ParamStr(1)) then begin
writeln('ERROR: resourcefilename = file',a);
exit;
end;
end;
ResourceFilename:=ParamStr(1);
try
ResFileStream:=TFileStream.Create(ResourceFilename,fmCreate);
@ -150,6 +164,5 @@ begin
ResMemStream.Free;
ResFileStream.Free;
end;
end;
end.