On 14 aug 2006, at 15:19, Mark Morgan Lloyd wrote:
This fails when the longest filename is around 119 characters, but
is OK
when it is a couple of characters shorter.
As an experiment, I'm going to leave the actual directory the same
length but
see if setting up a short symlink to it works.
Didn't help, make immediately expanded it to the full path.
Actually, I was wrong earlier on when I said it would always add 3
file names. It does this:
function GetNextFiles(const maxCmdLength : AInt; var item :
TStringListItem) : string;
begin
result := '';
while (assigned(item) and ((length(result) + length(item.str)
+ 1) < maxCmdLength)) do begin
result := result + ' ' + item.str;
item := TStringListItem(item.next);
end;
end;
...
repeat
Replace(nextcmd,'$FILES',GetNextFiles(240 - length(nextcmd)
+ 6 - length(binstr) - 1, current));
success:=DoExec(binstr,nextcmd,false,true);
nextcmd := cmdstr;
until (not assigned(current)) or (not success);
I'm not sure where exactly 119 fits in here, unless length(binstr)
(full path to your copy of ar) around 120 chars or so.
And it's clear that if not a single file name fits in this string,
this is going to produce an endless loop of empty "ar" invocations
(as you experienced)...
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal