mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 02:39:15 +02:00
MG: added file checks
git-svn-id: trunk@3378 -
This commit is contained in:
parent
fc096bf64a
commit
767b978afa
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user