ts_file: Simple sketch of std::filesystem for internal use.#4206
ts_file: Simple sketch of std::filesystem for internal use.#4206dragon512 merged 1 commit intoapache:masterfrom
Conversation
|
Looks nice. It might be a good use for the |
|
Soon, hopefully. @bryancall made the point that this should not be too similar to |
68c7ef8 to
276f783
Compare
| return fs._stat.st_mode & S_IFMT; | ||
| } | ||
|
|
||
| off_t |
There was a problem hiding this comment.
The standard uses std::uintmax_t
We should use the same value
| using self_type = path; | ||
|
|
||
| public: | ||
| static constexpr char SEPARATOR = '/'; |
There was a problem hiding this comment.
should be or add
typedef char value_type;
typedef basic_string<value_type> string_type;
static constexpr value_type preferred_separator = '/';
SEPARATOR should be removed or we should avoid usage of it outside this class/function set. Maybe change it to _SEPARATOR or use preferred_separator.
| inline bool | ||
| path::is_absolute() const | ||
| { | ||
| return !_path.empty() && '/' == _path[0]; |
There was a problem hiding this comment.
Should use the preferred_separator or SEPERATOR or have a _is_seperator function/macro
276f783 to
ae973cc
Compare
Having attempted and failed to get
std::filesystemready (it does not appear to be fully operational), this is a minimalist version that supplies only methods that are of immediate use. This is not intended to be a full replacement because that would be a huge amount of work and a waste because we will switch tostd::filesystemon the next major version where it is available. For the same reason, the implementation style of this is modeled closely onstd::filesystemto make the switch as easy as possible. An further implication of this is that no functionality not instd::filesystemshould be (1) segregated and clearly marked and (2) built on top ofstd::filesystemcompatible mechanisms. This is temporary expedient.P.S. Note that the semantics of the path operator "/" changed significantly between
std::experimental::filesystemandstd::filesystem. This implements the latter.This is based on work done for the Cache Tool, in "File.h" and "File.cc". Those were very rough and this is a recasting of those in the
std::filesystemstyle. This is something that would be quite helpful in the YAML conversion work, and obviously in the Cache Tool as well.