> function GetTempDir:String;
> const
> MaxPathLength = 255;
> var
> L :Integer;
> begin
> SetLength(Result,MaxPathLength+1);
> L := GetTempPath(MaxPathLength,PChar(Result));
> if L<>0 then begin
> if Result[L]<>'\' then begin
> inc(L);
> Result[L] := '\';
> end;
> SetLength(Result,L);
> end
> else Result := '';
> end;
>
> I tested it - it speeds up the function by a whole 1%! :) Have a good
> weekend.
Thankfully noones likely to hit GetTempPath in a tight loop - but with some
peoples
code I wonder ;) I think this routine is about as tight as a... The only
thing to do now
is use the correct constant for longest path rather than the synthesised one
I threw in...
--
Aaron@home
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz