mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-25 13:27:33 +00:00
dd8bff083f
There was a problem when displaying . and .. in directory listings: their names would normalise to actual names! So instead of literally seeing `.`, you’d see the current directory’s name, inserted in sort order into the list of results. Obviously this is not what we want. In unrelated news, putting `.` and `..` into the list of paths read from a directory just takes up more heap space for something that’s basically constant. We can solve both these problems at once by moving the DotFilter to the files iterator in Dir, rather than at the Dir’s creation. Having the iterator know whether it should display `.` and `..` means it can emit those files first, and because it knows what those files really represent, it can override their file names to actually be those sequences of dots. This is not a perfect solution: the main casualty is that a File can now be constructed with a name, some metadata, both, or neither. This is currently handled with a bunch of Options, and returns IOResult even without doing any IO operations. But at least all the tests pass!
388 B
388 B
.rw-r--r-- 0 cassowary 1 Jan 12:34 ..extra-hidden
.rw-r--r-- 0 cassowary 1 Jan 12:34 .hidden
.rw-r--r-- 0 cassowary 1 Jan 12:34 visible
.rw-r--r-- 0 cassowary 1 Jan 12:34 .hidden
.rw-r--r-- 0 cassowary 1 Jan 12:34 visible