Changeset 213


Ignore:
Timestamp:
Jun 13, 2007, 8:33:35 PM (18 years ago)
Author:
RBRi
Message:

use FileConstants

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Components/CustomFileControls.pas

    r188 r213  
    350350  Dialogs,
    351351  FileUtilsUnit,
    352   ACLStringUtility,
    353352  ACLUtility,
    354   BitmapUtility;
     353  BitmapUtility,
     354  StringUtilsUnit;
    355355
    356356var
     
    465465     While S<>'' Do
    466466     Begin
    467           NextFilter:=Pos(';',S);
     467          NextFilter:=Pos(PATH_SEPARATOR,S);
    468468          If NextFilter<>0 Then
    469469          Begin
     
    477477          End;
    478478
    479           Status := SysUtils.FindFirst(FDirectory + '\' + ThisFilter, Attr,Search);
     479          Status := SysUtils.FindFirst(FDirectory + DIRECTORY_SEPARATOR + ThisFilter, Attr,Search);
    480480          While Status = 0 Do
    481481          Begin
     
    490490     While S<>'' Do
    491491     Begin
    492           If Pos(';',S)<>0 Then
     492          If Pos(PATH_SEPARATOR,S)<>0 Then
    493493          Begin
    494494               s1:=S;
    495                Delete(s1,1,Pos(';',S));
    496                SetLength(S,Pos(';',S)-1);
     495               Delete(s1,1,Pos(PATH_SEPARATOR,S));
     496               SetLength(S,Pos(PATH_SEPARATOR,S)-1);
    497497          End
    498498          Else s1:='';
    499499
    500           Status := SysUtils.FindFirst(FDirectory + '\' + S, Attr,Search);
     500          Status := SysUtils.FindFirst(FDirectory + DIRECTORY_SEPARATOR + S, Attr,Search);
    501501          While Status = 0 Do
    502502          Begin
     
    560560          GetDir(Ord(UpCase(Drive))-Ord('A')+1,s);
    561561          {$I+}
    562           If (s[length(s)])='\' Then dec(s[0]);
    563           If not (NewDir[1] In ['/','\']) Then s:=s+'\';
     562          If (s[length(s)])=DIRECTORY_SEPARATOR Then dec(s[0]);
     563          If not (NewDir[1] In ['/',DIRECTORY_SEPARATOR]) Then s:=s+DIRECTORY_SEPARATOR;
    564564          NewDir:=s+NewDir;
    565565     End;
    566566
    567      If NewDir[Length(NewDir)] = '\' Then SetLength(NewDir,Length(NewDir)-1);
     567     If NewDir[Length(NewDir)] = DIRECTORY_SEPARATOR Then SetLength(NewDir,Length(NewDir)-1);
    568568     If FDirectory=NewDir Then exit;
    569569     FDirectory := NewDir;
     
    608608     Else Result := Items[ idx ];
    609609     s:=Directory;
    610      If s[Length(s)] In ['\','/'] Then dec(s[0]);
    611      If s<>'' Then If Result<>'' Then Result:=s+'\'+Result;
     610     If s[Length(s)] In [DIRECTORY_SEPARATOR,'/'] Then dec(s[0]);
     611     If s<>'' Then If Result<>'' Then Result:=s+DIRECTORY_SEPARATOR+Result;
    612612End;
    613613
     
    888888  IndentLevel: longint;
    889889  PathSoFar: string;
     890  tmpPathElements : TStringList;
     891  i : integer;
    890892Begin
    891893  Screen.Cursor := crHourGlass;
     
    903905  Path := Copy( Directory, 4, 255 );
    904906  PathSoFar := Copy( Directory, 1, 3 );
    905   While Path <> '' Do
    906   Begin
     907
     908  tmpPathElements := TStringList.Create;
     909  StrExtractStrings(tmpPathElements, Path, [DIRECTORY_SEPARATOR], #0);
     910
     911  for i := 0 to tmpPathElements.Count - 1 do
     912  begin
    907913    inc( IndentLevel );
    908     S:= ExtractNextValue( Path, '\' );
     914    S := tmpPathElements[i];
    909915
    910916    if not DirectoryExists( PathSoFar + S ) then
     
    915921    end;
    916922    Items.AddObject( S, pointer( IndentLevel ) );
    917     PathSoFar := PathSoFar + S + '\';
     923    PathSoFar := PathSoFar + S + DIRECTORY_SEPARATOR;
    918924  End;
    919925
     926  tmpPathElements.Destroy;
    920927  ItemIndex:= Items.Count - 1;
    921928
Note: See TracChangeset for help on using the changeset viewer.