Ignore:
Timestamp:
May 22, 2016, 2:09:18 PM (9 years ago)
Author:
RBRi
Message:

use stuff from the libs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Components/CustomFileControls.pas

    r15 r403  
    77
    88Uses
    9   Dos, SysUtils, Classes, Forms, StdCtrls, CustomListBox, Graphics;
     9  Dos,
     10  SysUtils,
     11  Classes,
     12  Forms,
     13  StdCtrls,
     14  CustomListBox,
     15  Graphics;
    1016
    1117
     
    337343
    338344Uses
    339 {$IFDEF OS2}
    340   BseDos, OS2Def, DriveInfoUnit,
    341   BseDev, BseErr,
    342 {$ENDIF}
    343 
    344 {$IFDEF Win95}
    345   WinBase,
    346 {$ENDIF}
     345  BseDos,
     346  OS2Def,
     347  BseDev,
     348  BseErr,
     349
    347350  Dialogs,
    348   ACLStringUtility, ACLUtility, ACLFileUtility, BitmapUtility;
     351  FileUtilsUnit,
     352  ACLUtility,
     353  BitmapUtility,
     354  StringUtilsUnit;
    349355
    350356var
     
    459465     While S<>'' Do
    460466     Begin
    461           NextFilter:=Pos(';',S);
     467          NextFilter:=Pos(PATH_SEPARATOR,S);
    462468          If NextFilter<>0 Then
    463469          Begin
     
    471477          End;
    472478
    473           Status := SysUtils.FindFirst(FDirectory + '\' + ThisFilter, Attr,Search);
     479          Status := SysUtils.FindFirst(FDirectory + DIRECTORY_SEPARATOR + ThisFilter, Attr,Search);
    474480          While Status = 0 Do
    475481          Begin
     
    484490     While S<>'' Do
    485491     Begin
    486           If Pos(';',S)<>0 Then
     492          If Pos(PATH_SEPARATOR,S)<>0 Then
    487493          Begin
    488494               s1:=S;
    489                Delete(s1,1,Pos(';',S));
    490                SetLength(S,Pos(';',S)-1);
     495               Delete(s1,1,Pos(PATH_SEPARATOR,S));
     496               SetLength(S,Pos(PATH_SEPARATOR,S)-1);
    491497          End
    492498          Else s1:='';
    493499
    494           Status := SysUtils.FindFirst(FDirectory + '\' + S, Attr,Search);
     500          Status := SysUtils.FindFirst(FDirectory + DIRECTORY_SEPARATOR + S, Attr,Search);
    495501          While Status = 0 Do
    496502          Begin
     
    554560          GetDir(Ord(UpCase(Drive))-Ord('A')+1,s);
    555561          {$I+}
    556           If (s[length(s)])='\' Then dec(s[0]);
    557           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;
    558564          NewDir:=s+NewDir;
    559565     End;
    560566
    561      If NewDir[Length(NewDir)] = '\' Then SetLength(NewDir,Length(NewDir)-1);
     567     If NewDir[Length(NewDir)] = DIRECTORY_SEPARATOR Then SetLength(NewDir,Length(NewDir)-1);
    562568     If FDirectory=NewDir Then exit;
    563569     FDirectory := NewDir;
     
    602608     Else Result := Items[ idx ];
    603609     s:=Directory;
    604      If s[Length(s)] In ['\','/'] Then dec(s[0]);
    605      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;
    606612End;
    607613
     
    864870    Data:= longint( Items.Objects[ Index ] );
    865871    if ( Data and dfSubDir ) = 0 then
    866       FullPath:= AddSlash( S ) + FullPath;
     872      FullPath:= AddDirectorySeparator( S ) + FullPath;
    867873    dec( Index );
    868874  end;
     
    882888  IndentLevel: longint;
    883889  PathSoFar: string;
     890  tmpPathElements : TStringList;
     891  i : integer;
    884892Begin
    885893  Screen.Cursor := crHourGlass;
     
    897905  Path := Copy( Directory, 4, 255 );
    898906  PathSoFar := Copy( Directory, 1, 3 );
    899   While Path <> '' Do
    900   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
    901913    inc( IndentLevel );
    902     S:= ExtractNextValue( Path, '\' );
     914    S := tmpPathElements[i];
    903915
    904916    if not DirectoryExists( PathSoFar + S ) then
     
    909921    end;
    910922    Items.AddObject( S, pointer( IndentLevel ) );
    911     PathSoFar := PathSoFar + S + '\';
     923    PathSoFar := PathSoFar + S + DIRECTORY_SEPARATOR;
    912924  End;
    913925
     926  tmpPathElements.Destroy;
    914927  ItemIndex:= Items.Count - 1;
    915928
     
    918931  SubDirs:= TStringList.Create;
    919932
    920   Status := SysUtils.FindFirst( AddSlash( Directory ) + '*.*', faDirectory, Search);
     933  Status := SysUtils.FindFirst( AddDirectorySeparator( Directory ) + '*.*', faDirectory, Search);
    921934  While Status = 0 Do
    922935  Begin
     
    967980    GetDir(Ord(UpCase(Drive))-Ord('A')+1,s);
    968981    {$I+}
    969     S:= RemoveSlash( S );
    970     S:= AddSlash( S );
     982    S:= RemoveRightDirectorySeparator( S );
     983    S:= AddDirectorySeparator( S );
    971984    NewDir:=s+NewDir;
    972985  End;
    973986
    974   NewDir:= RemoveSlash( NewDir );
     987  NewDir:= RemoveRightDirectorySeparator( NewDir );
    975988
    976989  FDirectory := NewDir;
     
    11161129      begin
    11171130        try
    1118           DriveLabel := GetVolumeLabel( DriveNumberToLetter( DriveNumber ) );
     1131          DriveLabel := GetVolumeLabel( DriveNumberToDriveLetter( DriveNumber ) );
    11191132          DriveString := DriveString + DriveLabel;
    11201133        except
     
    11421155    on EInOutError do
    11431156      // Current drive inaccessible
    1144       Drive := GetBootDrive;
     1157      Drive := GetBootDriveLetter;
    11451158  end;
    11461159End;
     
    12611274                                // and the user doesn't want to retry,
    12621275                                // so go back to boot drive.
    1263                                 SetDrive( GetBootDrive );
     1276                                SetDrive(GetBootDriveLetter);
    12641277                                Screen.Cursor := crDefault;
    12651278                                Exit;
Note: See TracChangeset for help on using the changeset viewer.