On Sat, 4 Mar 2006, Joao Morais wrote:
Hello,
Should this comparison (!) be fixed? Seeing that this code is going to
be changed, what about change Pa[I] assignment from a variable to a
constant?
The comparison can be fixed.
In fact I think the code can be reduced to a single loop:
if (DirectorySeparator='\') or (DirectorySeparator='/') then
for I:=1 to Length(PA) do
if (Pa[I] in ['\','/']) and (PA[I]DirectorySeparator) then
Pa[I]:=DirectorySeparator;
Could you test this, please ?
Michael.
rtl/inc/fexpand.inc
(* Allow both '/' and '\' as directory separators *)
(* by converting all to the native one. *)
if DirectorySeparator = '\' then
{Allow slash as backslash}
begin
for I := 1 to Length (Pa) do
if Pa [I] = '/' then
Pa [I] := DirectorySeparator
end
else
! if DirectorySeparator = '\' then
{Allow backslash as slash}
begin
for I := 1 to Length (Pa) do
if Pa [I] = '\' then
Pa [I] := DirectorySeparator;
end;
Thanks,
--
Joao Morais
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel