Don't make assumptions about Metadata based on temp_dir #622
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, exa would attempt to get the metadata for
std::env::temp_dir
, and if fetching a certain timestamp(e.g., creation time) failed, it would assume that the OS couldn't
produce that stamp for any file. Requests to display or sort by that
timestamp would misfire the entire program.
This caused exa to make some sweeping claims that aren't true; e.g., that
Linux can't produce file creation times. The real story is that tmpfs
(the filesystem usually used for
/tmp
) can't, but other Linuxfilesystems can and do. (The Rust standard library docs even mention
that
Metadata.created()
is backed bystatx()
since Linux 4.11.)Since exa could be asked to list files from several filesystems,
let's handle metadata on a per-file basis. This patch makes File's
*_time()
methods return an Option(
changed_time()
always returns None on a non-Unix system),and prints a hyphen for files without that particular timestamp.
For example: