From 27291df9ada5331c12eb4cb98bc5452139dce9de Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 2 Sep 2020 08:52:13 -0700 Subject: [PATCH] Sort Pathclass by normcase instead of absolute path. --- voussoirkit/pathclass.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index ee2573c..616b67e 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -94,13 +94,17 @@ class Path: def __eq__(self, other): if not hasattr(other, 'absolute_path'): return False + # Compare by normcase so that Windows's case-insensitive filenames + # behave correctly. return self.normcase == other.normcase def __hash__(self): return hash(self.normcase) def __lt__(self, other): - return self.absolute_path < other.absolute_path + # Sort by normcase so that Windows's case-insensitive filenames sort + # alphabetically regardless of case. + return self.normcase < other.normcase def __repr__(self): return '{c}({path})'.format(c=self.__class__.__name__, path=repr(self.absolute_path))