Also sort symlinks to directories first

This commit is contained in:
Přemysl Eric Janouch 2018-11-10 01:32:59 +01:00
parent fad0d264a5
commit aae9c392fa
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 4 additions and 2 deletions

View File

@ -707,8 +707,10 @@ fun update () {
} }
fun operator< (const entry &e1, const entry &e2) -> bool { fun operator< (const entry &e1, const entry &e2) -> bool {
auto t1 = make_tuple (e1.filename != "..", !S_ISDIR (e1.info.st_mode)); auto t1 = make_tuple (e1.filename != "..",
auto t2 = make_tuple (e2.filename != "..", !S_ISDIR (e2.info.st_mode)); !S_ISDIR (e1.info.st_mode) && !S_ISDIR (e1.target_info.st_mode));
auto t2 = make_tuple (e2.filename != "..",
!S_ISDIR (e2.info.st_mode) && !S_ISDIR (e2.target_info.st_mode));
if (t1 != t2) if (t1 != t2)
return t1 < t2; return t1 < t2;