mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: comparison can be performed even for TFiles without AttributesProperty in FilesSortFoldersFirst()
This commit is contained in:
parent
523c15e297
commit
d61293302e
1 changed files with 11 additions and 6 deletions
|
|
@ -794,12 +794,17 @@ end;
|
|||
|
||||
function FilesSortFoldersFirst(List: TStringList; Index1, Index2: Integer): Integer;
|
||||
var
|
||||
Attr1, Attr2: TFileAttributesProperty;
|
||||
attr1: TFileAttributesProperty;
|
||||
attr2: TFileAttributesProperty;
|
||||
isDir1: Boolean;
|
||||
isDir2: Boolean;
|
||||
begin
|
||||
Attr1:= TFileAttributesProperty(List.Objects[Index1]);
|
||||
Attr2:= TFileAttributesProperty(List.Objects[Index2]);
|
||||
if Attr1.IsDirectory xor Attr2.IsDirectory then begin
|
||||
if Attr1.IsDirectory then
|
||||
attr1:= TFileAttributesProperty(List.Objects[Index1]);
|
||||
isDir1:= Assigned(attr1) and attr1.IsDirectory;
|
||||
attr2:= TFileAttributesProperty(List.Objects[Index2]);
|
||||
isDir2:= Assigned(attr2) and attr2.IsDirectory;
|
||||
if isDir1 xor isDir2 then begin
|
||||
if isDir1 then
|
||||
Result:= -1
|
||||
else begin
|
||||
Result:= 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue