Hi,

On 31/03/2011 10:06, Darius Blaszyk wrote:
> 
> This simplifies things quite a bit. Thanks for the hint. Here's a new patch, 
> I also added a fix for the command line options issue. Should be alright now. 
> All examples work fine on win32.
> 
> Darius

I haven't tried to run that yet, but, why not

...
  {$IFNDEF MSWINDOWS}
   Halt(FpExecV(Filename,p));
  {$ELSE}
   Halt(ExecuteProcess(Filename,CollectArgs(p)));
  {$ENDIF}
...

and then in another function, CollectArgs:

function CollectArgs(p: PPChar):string;
begin
//   Result := '';
  Inc(p); //lose the first command-line argument with the the script filename
  while (p^ <> nil) do
  begin
    Result := Result + ' ' + p^^;
    inc(p);
  end;
end;

Reason : there is no error checking nor any try/except construct 
involved/needed 
in this code, and it seems more, hm... readable when split ? 

Lukasz

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to