From aae9c392fab706f5470c0d1d7089ec8fbb828eb2 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch
Date: Sat, 10 Nov 2018 01:32:59 +0100 Subject: Also sort symlinks to directories first --- sdn.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdn.cpp b/sdn.cpp index 044cfd6..ba849a4 100644 --- a/sdn.cpp +++ b/sdn.cpp @@ -707,8 +707,10 @@ fun update () { } fun operator< (const entry &e1, const entry &e2) -> bool { - auto t1 = make_tuple (e1.filename != "..", !S_ISDIR (e1.info.st_mode)); - auto t2 = make_tuple (e2.filename != "..", !S_ISDIR (e2.info.st_mode)); + auto t1 = make_tuple (e1.filename != "..", + !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) return t1 < t2; -- cgit v1.2.3-70-g09d2