#375831 - Sort empty file extensions correctly
Summary:
This change makes sure that empty strings are sorted before non-empty strings. Note that it is treating the case where both strings are equal specially, this is for consistency with the logic at the bottom of compareTextsAlphabetical() and compareTextsCharacterCode(). I don't see a difference if I leave out this case but if it is important then personally I would have written this differently:
if (aS2.length() == 0) { return false; } else if (aS1.length() == 0) { return true; }
The checks in compareTextsAlphabetical() can be simplified similarly:
if (lPositionS2 == aS2.length()) return false; else if (lPositionS1 == aS1.length()) return true;
These two comparisons produce the same result as the six comparisons currently there.
Test Plan: See STR in bug.
Reviewers: Krusader, martinkostolny, abika, asensi
Reviewed By: Krusader, martinkostolny, abika, asensi
Subscribers: asensi, martinkostolny, Krusader
Tags: Krusader
Differential Revision: https://phabricator.kde.org/D4417
BUG: 375831