you are right.
but i opted for a different solution
result:=0;
case sortby of
SB_SIZE: result:=compare_(f1.size, f2.size);
SB_TIME: result:=-compare_(f1.mtime, f2.mtime);
SB_DL: result:=-compare_(f1.DLcount, f2.DLcount);
SB_EXT:
if not f1.isFolder() and not f2.isFolder() then
result:=compareExt(f1.name, f2.name);
SB_COMMENT: result:=ansiCompareText(f1.comment, f2.comment);
end;
because compareText is already done below when result is 0, and we should not mess with folders-before because it's already handled few lines above.