Commit c2249535 authored by Derek Murray's avatar Derek Murray Committed by TensorFlower Gardener
Browse files

Replace `FileStatistics::mode` with `FileStatistics::is_directory`.

The output of `stat()` is platform- and filesystem-dependent, so the
current API that exports a file's mode as a bitfield is not
portable. For example, on POSIX-based systems we use `mode_t` and
`S_ISDIR()` to test whether a file is a directory, whereas on Windows
we would would access the `_S_IFDIR` bit of an `st_mode`
bitfield. Note also that the GCS filesystem would set the mode
arbitrarily as 0600, because there is no direct mapping between GCS
file attributes and POSIX modes.

This CL removes the `mode_t mode` field and replaces it with a `bool
is_directory` field, which corresponds to the only use of that field
that I've been able to find, and which can be set as appropriate in
platform-specific code. If and when other attributes of a file
(e.g. permissions) are needed, these can be handled similarly.
Change: 132698567
parent 80520829
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment