WPILibC++  2020.3.2
FileSystem.h
1 //===- llvm/Support/FileSystem.h - File System OS Concept -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the wpi::sys::fs namespace. It is designed after
11 // TR2/boost filesystem (v3), but modified to remove exception handling and the
12 // path class.
13 //
14 // All functions return an error_code and their actual work via the last out
15 // argument. The out argument is defined if and only if errc::success is
16 // returned. A function may return any error code in the generic or system
17 // category. However, they shall be equivalent to any error conditions listed
18 // in each functions respective documentation if the condition applies. [ note:
19 // this does not guarantee that error_code will be in the set of explicitly
20 // listed codes, but it does guarantee that if any of the explicitly listed
21 // errors occur, the correct error_code will be used ]. All functions may
22 // return errc::not_enough_memory if there is not enough memory to complete the
23 // operation.
24 //
25 //===----------------------------------------------------------------------===//
26 
27 #ifndef WPIUTIL_WPI_FILESYSTEM_H
28 #define WPIUTIL_WPI_FILESYSTEM_H
29 
30 #include "wpi/Chrono.h"
31 #include "wpi/SmallString.h"
32 #include "wpi/StringRef.h"
33 #include "wpi/Twine.h"
34 #include "wpi/Error.h"
35 #include "wpi/ErrorHandling.h"
36 #include "wpi/ErrorOr.h"
37 #include <cassert>
38 #include <cstdint>
39 #include <ctime>
40 #include <memory>
41 #include <stack>
42 #include <string>
43 #include <system_error>
44 #include <tuple>
45 #include <vector>
46 
47 #include <sys/stat.h>
48 
49 namespace wpi {
50 namespace sys {
51 namespace fs {
52 
53 #if defined(_WIN32)
54 // A Win32 HANDLE is a typedef of void*
55 using file_t = void *;
56 #else
57 using file_t = int;
58 #endif
59 
60 extern const file_t kInvalidFile;
61 
63 enum class file_type {
64  status_error,
65  file_not_found,
66  regular_file,
67  directory_file,
68  symlink_file,
69  block_file,
70  character_file,
71  fifo_file,
72  socket_file,
73  type_unknown
74 };
75 
77 struct space_info {
78  uint64_t capacity;
79  uint64_t free;
80  uint64_t available;
81 };
82 
83 enum perms {
84  no_perms = 0,
85  owner_read = 0400,
86  owner_write = 0200,
87  owner_exe = 0100,
88  owner_all = owner_read | owner_write | owner_exe,
89  group_read = 040,
90  group_write = 020,
91  group_exe = 010,
92  group_all = group_read | group_write | group_exe,
93  others_read = 04,
94  others_write = 02,
95  others_exe = 01,
96  others_all = others_read | others_write | others_exe,
97  all_read = owner_read | group_read | others_read,
98  all_write = owner_write | group_write | others_write,
99  all_exe = owner_exe | group_exe | others_exe,
100  all_all = owner_all | group_all | others_all,
101  set_uid_on_exe = 04000,
102  set_gid_on_exe = 02000,
103  sticky_bit = 01000,
104  all_perms = all_all | set_uid_on_exe | set_gid_on_exe | sticky_bit,
105  perms_not_known = 0xFFFF
106 };
107 
108 // Helper functions so that you can use & and | to manipulate perms bits:
109 inline perms operator|(perms l, perms r) {
110  return static_cast<perms>(static_cast<unsigned short>(l) |
111  static_cast<unsigned short>(r));
112 }
113 inline perms operator&(perms l, perms r) {
114  return static_cast<perms>(static_cast<unsigned short>(l) &
115  static_cast<unsigned short>(r));
116 }
117 inline perms &operator|=(perms &l, perms r) {
118  l = l | r;
119  return l;
120 }
121 inline perms &operator&=(perms &l, perms r) {
122  l = l & r;
123  return l;
124 }
125 inline perms operator~(perms x) {
126  // Avoid UB by explicitly truncating the (unsigned) ~ result.
127  return static_cast<perms>(
128  static_cast<unsigned short>(~static_cast<unsigned short>(x)));
129 }
130 
131 class UniqueID {
132  uint64_t Device;
133  uint64_t File;
134 
135 public:
136  UniqueID() = default;
137  UniqueID(uint64_t Device, uint64_t File) : Device(Device), File(File) {}
138 
139  bool operator==(const UniqueID &Other) const {
140  return Device == Other.Device && File == Other.File;
141  }
142  bool operator!=(const UniqueID &Other) const { return !(*this == Other); }
143  bool operator<(const UniqueID &Other) const {
144  return std::tie(Device, File) < std::tie(Other.Device, Other.File);
145  }
146 
147  uint64_t getDevice() const { return Device; }
148  uint64_t getFile() const { return File; }
149 };
150 
155 protected:
156  #ifndef _WIN32
157  time_t fs_st_atime = 0;
158  time_t fs_st_mtime = 0;
159  uint32_t fs_st_atime_nsec = 0;
160  uint32_t fs_st_mtime_nsec = 0;
161  uid_t fs_st_uid = 0;
162  gid_t fs_st_gid = 0;
163  off_t fs_st_size = 0;
164  #else
165  uint32_t LastAccessedTimeHigh = 0;
166  uint32_t LastAccessedTimeLow = 0;
167  uint32_t LastWriteTimeHigh = 0;
168  uint32_t LastWriteTimeLow = 0;
169  uint32_t FileSizeHigh = 0;
170  uint32_t FileSizeLow = 0;
171  #endif
172  file_type Type = file_type::status_error;
173  perms Perms = perms_not_known;
174 
175 public:
176  basic_file_status() = default;
177 
178  explicit basic_file_status(file_type Type) : Type(Type) {}
179 
180  #ifndef _WIN32
181  basic_file_status(file_type Type, perms Perms, time_t ATime,
182  uint32_t ATimeNSec, time_t MTime, uint32_t MTimeNSec,
183  uid_t UID, gid_t GID, off_t Size)
184  : fs_st_atime(ATime), fs_st_mtime(MTime),
185  fs_st_atime_nsec(ATimeNSec), fs_st_mtime_nsec(MTimeNSec),
186  fs_st_uid(UID), fs_st_gid(GID),
187  fs_st_size(Size), Type(Type), Perms(Perms) {}
188  #else
189  basic_file_status(file_type Type, perms Perms, uint32_t LastAccessTimeHigh,
190  uint32_t LastAccessTimeLow, uint32_t LastWriteTimeHigh,
191  uint32_t LastWriteTimeLow, uint32_t FileSizeHigh,
192  uint32_t FileSizeLow)
193  : LastAccessedTimeHigh(LastAccessTimeHigh),
194  LastAccessedTimeLow(LastAccessTimeLow),
195  LastWriteTimeHigh(LastWriteTimeHigh),
196  LastWriteTimeLow(LastWriteTimeLow), FileSizeHigh(FileSizeHigh),
197  FileSizeLow(FileSizeLow), Type(Type), Perms(Perms) {}
198  #endif
199 
200  // getters
201  file_type type() const { return Type; }
202  perms permissions() const { return Perms; }
203 
208  TimePoint<> getLastAccessedTime() const;
209 
217  TimePoint<> getLastModificationTime() const;
218 
219  #ifndef _WIN32
220  uint32_t getUser() const { return fs_st_uid; }
221  uint32_t getGroup() const { return fs_st_gid; }
222  uint64_t getSize() const { return fs_st_size; }
223  #else
224  uint32_t getUser() const {
225  return 9999; // Not applicable to Windows, so...
226  }
227 
228  uint32_t getGroup() const {
229  return 9999; // Not applicable to Windows, so...
230  }
231 
232  uint64_t getSize() const {
233  return (uint64_t(FileSizeHigh) << 32) + FileSizeLow;
234  }
235  #endif
236 
237  // setters
238  void type(file_type v) { Type = v; }
239  void permissions(perms p) { Perms = p; }
240 };
241 
244  friend bool equivalent(file_status A, file_status B);
245 
246  #ifndef _WIN32
247  dev_t fs_st_dev = 0;
248  nlink_t fs_st_nlinks = 0;
249  ino_t fs_st_ino = 0;
250  #else
251  uint32_t NumLinks = 0;
252  uint32_t VolumeSerialNumber = 0;
253  uint32_t FileIndexHigh = 0;
254  uint32_t FileIndexLow = 0;
255  #endif
256 
257 public:
258  file_status() = default;
259 
260  explicit file_status(file_type Type) : basic_file_status(Type) {}
261 
262  #ifndef _WIN32
263  file_status(file_type Type, perms Perms, dev_t Dev, nlink_t Links, ino_t Ino,
264  time_t ATime, uint32_t ATimeNSec,
265  time_t MTime, uint32_t MTimeNSec,
266  uid_t UID, gid_t GID, off_t Size)
267  : basic_file_status(Type, Perms, ATime, ATimeNSec, MTime, MTimeNSec,
268  UID, GID, Size),
269  fs_st_dev(Dev), fs_st_nlinks(Links), fs_st_ino(Ino) {}
270  #else
271  file_status(file_type Type, perms Perms, uint32_t LinkCount,
272  uint32_t LastAccessTimeHigh, uint32_t LastAccessTimeLow,
273  uint32_t LastWriteTimeHigh, uint32_t LastWriteTimeLow,
274  uint32_t VolumeSerialNumber, uint32_t FileSizeHigh,
275  uint32_t FileSizeLow, uint32_t FileIndexHigh,
276  uint32_t FileIndexLow)
277  : basic_file_status(Type, Perms, LastAccessTimeHigh, LastAccessTimeLow,
278  LastWriteTimeHigh, LastWriteTimeLow, FileSizeHigh,
279  FileSizeLow),
280  NumLinks(LinkCount), VolumeSerialNumber(VolumeSerialNumber),
281  FileIndexHigh(FileIndexHigh), FileIndexLow(FileIndexLow) {}
282  #endif
283 
284  UniqueID getUniqueID() const;
285  uint32_t getLinkCount() const;
286 };
287 
291 
301 void make_absolute(const Twine &current_directory, SmallVectorImpl<char> &path);
302 
314 std::error_code make_absolute(SmallVectorImpl<char> &path);
315 
321 std::error_code current_path(SmallVectorImpl<char> &result);
322 
326 
332 bool exists(const basic_file_status &status);
333 
334 enum class AccessMode { Exist, Write, Execute };
335 
341 std::error_code access(const Twine &Path, AccessMode Mode);
342 
347 inline bool exists(const Twine &Path) {
348  return !access(Path, AccessMode::Exist);
349 }
350 
355 inline bool can_write(const Twine &Path) {
356  return !access(Path, AccessMode::Write);
357 }
358 
368 bool equivalent(file_status A, file_status B);
369 
380 std::error_code equivalent(const Twine &A, const Twine &B, bool &result);
381 
384 inline bool equivalent(const Twine &A, const Twine &B) {
385  bool result;
386  return !equivalent(A, B, result) && result;
387 }
388 
395 file_type get_file_type(const Twine &Path, bool Follow = true);
396 
401 bool is_directory(const basic_file_status &status);
402 
410 std::error_code is_directory(const Twine &path, bool &result);
411 
414 inline bool is_directory(const Twine &Path) {
415  bool Result;
416  return !is_directory(Path, Result) && Result;
417 }
418 
423 bool is_regular_file(const basic_file_status &status);
424 
432 std::error_code is_regular_file(const Twine &path, bool &result);
433 
436 inline bool is_regular_file(const Twine &Path) {
437  bool Result;
438  if (is_regular_file(Path, Result))
439  return false;
440  return Result;
441 }
442 
447 bool is_symlink_file(const basic_file_status &status);
448 
456 std::error_code is_symlink_file(const Twine &path, bool &result);
457 
460 inline bool is_symlink_file(const Twine &Path) {
461  bool Result;
462  if (is_symlink_file(Path, Result))
463  return false;
464  return Result;
465 }
466 
472 bool is_other(const basic_file_status &status);
473 
482 std::error_code is_other(const Twine &path, bool &result);
483 
492 std::error_code status(const Twine &path, file_status &result,
493  bool follow = true);
494 
496 std::error_code status(int FD, file_status &Result);
497 
502 bool status_known(const basic_file_status &s);
503 
510 std::error_code status_known(const Twine &path, bool &result);
511 
512 enum CreationDisposition : unsigned {
516  CD_CreateAlways = 0,
517 
521  CD_CreateNew = 1,
522 
526  CD_OpenExisting = 2,
527 
531  CD_OpenAlways = 3,
532 };
533 
534 enum FileAccess : unsigned {
535  FA_Read = 1,
536  FA_Write = 2,
537 };
538 
539 enum OpenFlags : unsigned {
540  OF_None = 0,
541  F_None = 0, // For compatibility
542 
545  OF_Text = 1,
546  F_Text = 1, // For compatibility
547 
549  OF_Append = 2,
550  F_Append = 2, // For compatibility
551 
553  OF_Delete = 4,
554 
557  OF_ChildInherit = 8,
558 
560  OF_UpdateAtime = 16,
561 };
562 
563 inline OpenFlags operator|(OpenFlags A, OpenFlags B) {
564  return OpenFlags(unsigned(A) | unsigned(B));
565 }
566 
567 inline OpenFlags &operator|=(OpenFlags &A, OpenFlags B) {
568  A = A | B;
569  return A;
570 }
571 
572 inline FileAccess operator|(FileAccess A, FileAccess B) {
573  return FileAccess(unsigned(A) | unsigned(B));
574 }
575 
576 inline FileAccess &operator|=(FileAccess &A, FileAccess B) {
577  A = A | B;
578  return A;
579 }
580 
597 std::error_code openFile(const Twine &Name, int &ResultFD,
598  CreationDisposition Disp, FileAccess Access,
599  OpenFlags Flags, unsigned Mode = 0666);
600 
615 Expected<file_t> openNativeFile(const Twine &Name, CreationDisposition Disp,
616  FileAccess Access, OpenFlags Flags,
617  unsigned Mode = 0666);
618 
634 inline std::error_code
635 openFileForWrite(const Twine &Name, int &ResultFD,
636  CreationDisposition Disp = CD_CreateAlways,
637  OpenFlags Flags = OF_None, unsigned Mode = 0666) {
638  return openFile(Name, ResultFD, Disp, FA_Write, Flags, Mode);
639 }
640 
654 inline Expected<file_t> openNativeFileForWrite(const Twine &Name,
655  CreationDisposition Disp,
656  OpenFlags Flags,
657  unsigned Mode = 0666) {
658  return openNativeFile(Name, Disp, FA_Write, Flags, Mode);
659 }
660 
676 inline std::error_code openFileForReadWrite(const Twine &Name, int &ResultFD,
677  CreationDisposition Disp,
678  OpenFlags Flags,
679  unsigned Mode = 0666) {
680  return openFile(Name, ResultFD, Disp, FA_Write | FA_Read, Flags, Mode);
681 }
682 
696 inline Expected<file_t> openNativeFileForReadWrite(const Twine &Name,
697  CreationDisposition Disp,
698  OpenFlags Flags,
699  unsigned Mode = 0666) {
700  return openNativeFile(Name, Disp, FA_Write | FA_Read, Flags, Mode);
701 }
702 
717 std::error_code openFileForRead(const Twine &Name, int &ResultFD,
718  OpenFlags Flags = OF_None,
719  SmallVectorImpl<char> *RealPath = nullptr);
720 
733 Expected<file_t>
734 openNativeFileForRead(const Twine &Name, OpenFlags Flags = OF_None,
735  SmallVectorImpl<char> *RealPath = nullptr);
736 
742 void closeFile(file_t &F);
743 
744 std::error_code getUniqueID(const Twine Path, UniqueID &Result);
745 
749 public:
750  enum mapmode {
754  };
755 
756 private:
758  size_t Size;
759  void *Mapping;
760 #ifdef _WIN32
761  void *FileHandle;
762 #endif
763  mapmode Mode;
764 
765  std::error_code init(int FD, uint64_t Offset, mapmode Mode);
766 
767 public:
768  mapped_file_region() = delete;
770  mapped_file_region &operator =(mapped_file_region&) = delete;
771 
775  mapped_file_region(int fd, mapmode mode, size_t length, uint64_t offset,
776  std::error_code &ec);
777 
779 
780  size_t size() const;
781  char *data() const;
782 
785  const char *const_data() const;
786 
788  static int alignment();
789 };
790 
794 
799  std::string Path;
800  file_type Type; // Most platforms can provide this.
801  bool FollowSymlinks; // Affects the behavior of status().
802  basic_file_status Status; // If available.
803 
804 public:
805  explicit directory_entry(const Twine &Path, bool FollowSymlinks = true,
806  file_type Type = file_type::type_unknown,
808  : Path(Path.str()), Type(Type), FollowSymlinks(FollowSymlinks),
809  Status(Status) {}
810 
811  directory_entry() = default;
812 
813  void replace_filename(const Twine &Filename, file_type Type,
815 
816  const std::string &path() const { return Path; }
817  ErrorOr<basic_file_status> status() const;
818  file_type type() const {
819  if (Type != file_type::type_unknown)
820  return Type;
821  auto S = status();
822  return S ? S->type() : file_type::type_unknown;
823  }
824 
825  bool operator==(const directory_entry& RHS) const { return Path == RHS.Path; }
826  bool operator!=(const directory_entry& RHS) const { return !(*this == RHS); }
827  bool operator< (const directory_entry& RHS) const;
828  bool operator<=(const directory_entry& RHS) const;
829  bool operator> (const directory_entry& RHS) const;
830  bool operator>=(const directory_entry& RHS) const;
831 };
832 
833 namespace detail {
834 
835  struct DirIterState;
836 
837  std::error_code directory_iterator_construct(DirIterState &, StringRef, bool);
838  std::error_code directory_iterator_increment(DirIterState &);
839  std::error_code directory_iterator_destruct(DirIterState &);
840 
842  struct DirIterState {
843  ~DirIterState() {
844  directory_iterator_destruct(*this);
845  }
846 
847  intptr_t IterationHandle = 0;
848  directory_entry CurrentEntry;
849  };
850 
851 } // end namespace detail
852 
857  std::shared_ptr<detail::DirIterState> State;
858  bool FollowSymlinks = true;
859 
860 public:
861  explicit directory_iterator(const Twine &path, std::error_code &ec,
862  bool follow_symlinks = true)
863  : FollowSymlinks(follow_symlinks) {
864  State = std::make_shared<detail::DirIterState>();
865  SmallString<128> path_storage;
866  ec = detail::directory_iterator_construct(
867  *State, path.toStringRef(path_storage), FollowSymlinks);
868  }
869 
870  explicit directory_iterator(const directory_entry &de, std::error_code &ec,
871  bool follow_symlinks = true)
872  : FollowSymlinks(follow_symlinks) {
873  State = std::make_shared<detail::DirIterState>();
874  ec = detail::directory_iterator_construct(
875  *State, de.path(), FollowSymlinks);
876  }
877 
879  directory_iterator() = default;
880 
881  // No operator++ because we need error_code.
882  directory_iterator &increment(std::error_code &ec) {
883  ec = directory_iterator_increment(*State);
884  return *this;
885  }
886 
887  const directory_entry &operator*() const { return State->CurrentEntry; }
888  const directory_entry *operator->() const { return &State->CurrentEntry; }
889 
890  bool operator==(const directory_iterator &RHS) const {
891  if (State == RHS.State)
892  return true;
893  if (!RHS.State)
894  return State->CurrentEntry == directory_entry();
895  if (!State)
896  return RHS.State->CurrentEntry == directory_entry();
897  return State->CurrentEntry == RHS.State->CurrentEntry;
898  }
899 
900  bool operator!=(const directory_iterator &RHS) const {
901  return !(*this == RHS);
902  }
903 };
904 
905 namespace detail {
906 
909  std::stack<directory_iterator, std::vector<directory_iterator>> Stack;
910  uint16_t Level = 0;
911  bool HasNoPushRequest = false;
912  };
913 
914 } // end namespace detail
915 
919  std::shared_ptr<detail::RecDirIterState> State;
920  bool Follow;
921 
922 public:
923  recursive_directory_iterator() = default;
924  explicit recursive_directory_iterator(const Twine &path, std::error_code &ec,
925  bool follow_symlinks = true)
926  : State(std::make_shared<detail::RecDirIterState>()),
927  Follow(follow_symlinks) {
928  State->Stack.push(directory_iterator(path, ec, Follow));
929  if (State->Stack.top() == directory_iterator())
930  State.reset();
931  }
932 
933  // No operator++ because we need error_code.
934  recursive_directory_iterator &increment(std::error_code &ec) {
935  const directory_iterator end_itr = {};
936 
937  if (State->HasNoPushRequest)
938  State->HasNoPushRequest = false;
939  else {
940  file_type type = State->Stack.top()->type();
941  if (type == file_type::symlink_file && Follow) {
942  // Resolve the symlink: is it a directory to recurse into?
943  ErrorOr<basic_file_status> status = State->Stack.top()->status();
944  if (status)
945  type = status->type();
946  // Otherwise broken symlink, and we'll continue.
947  }
948  if (type == file_type::directory_file) {
949  State->Stack.push(directory_iterator(*State->Stack.top(), ec, Follow));
950  if (State->Stack.top() != end_itr) {
951  ++State->Level;
952  return *this;
953  }
954  State->Stack.pop();
955  }
956  }
957 
958  while (!State->Stack.empty()
959  && State->Stack.top().increment(ec) == end_itr) {
960  State->Stack.pop();
961  --State->Level;
962  }
963 
964  // Check if we are done. If so, create an end iterator.
965  if (State->Stack.empty())
966  State.reset();
967 
968  return *this;
969  }
970 
971  const directory_entry &operator*() const { return *State->Stack.top(); }
972  const directory_entry *operator->() const { return &*State->Stack.top(); }
973 
974  // observers
976  int level() const { return State->Level; }
977 
979  bool no_push_request() const { return State->HasNoPushRequest; }
980 
981  // modifiers
983  void pop() {
984  assert(State && "Cannot pop an end iterator!");
985  assert(State->Level > 0 && "Cannot pop an iterator with level < 1");
986 
987  const directory_iterator end_itr = {};
988  std::error_code ec;
989  do {
990  if (ec) {
991  //report_fatal_error("Error incrementing directory iterator.");
992  while (!State->Stack.empty()) State->Stack.pop();
993  break;
994  }
995  State->Stack.pop();
996  --State->Level;
997  } while (!State->Stack.empty()
998  && State->Stack.top().increment(ec) == end_itr);
999 
1000  // Check if we are done. If so, create an end iterator.
1001  if (State->Stack.empty())
1002  State.reset();
1003  }
1004 
1006  void no_push() { State->HasNoPushRequest = true; }
1007 
1008  bool operator==(const recursive_directory_iterator &RHS) const {
1009  return State == RHS.State;
1010  }
1011 
1012  bool operator!=(const recursive_directory_iterator &RHS) const {
1013  return !(*this == RHS);
1014  }
1015 };
1016 
1018 
1019 } // end namespace fs
1020 } // end namespace sys
1021 } // end namespace wpi
1022 
1023 #endif // LLVM_SUPPORT_FILESYSTEM_H
wpi::sys::fs::space_info
space_info - Self explanatory.
Definition: FileSystem.h:77
wpi::sys::fs::mapped_file_region::readonly
May only access map via const_data as read only.
Definition: FileSystem.h:751
wpi::Twine::toStringRef
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
Definition: Twine.h:450
wpi::sys::fs::basic_file_status::getLastModificationTime
TimePoint getLastModificationTime() const
The file modification time as reported from the underlying file system.
wpi::sys::fs::file_status::equivalent
friend bool equivalent(file_status A, file_status B)
Do file_status's represent the same thing?
wpi::sys::fs::directory_iterator
directory_iterator - Iterates through the entries in path.
Definition: FileSystem.h:856
wpi::sys::fs::directory_iterator::directory_iterator
directory_iterator()=default
Construct end iterator.
wpi::sys::fs::recursive_directory_iterator
recursive_directory_iterator - Same as directory_iterator except for it recurses down into child dire...
Definition: FileSystem.h:918
wpi::sys::fs::directory_entry
directory_entry - A single entry in a directory.
Definition: FileSystem.h:798
wpi::SmallVectorImpl< char >
wpi::sys::fs::UniqueID
Definition: FileSystem.h:131
wpi::ErrorOr
Represents either an error or a value T.
Definition: ErrorOr.h:57
wpi::sys::fs::mapped_file_region
This class represents a memory mapped file.
Definition: FileSystem.h:748
wpi::sys::fs::basic_file_status
Represents the result of a call to directory_iterator::status().
Definition: FileSystem.h:154
wpi
WPILib C++ utilities (wpiutil) namespace.
Definition: EventLoopRunner.h:17
wpi::sys::fs::mapped_file_region::alignment
static int alignment()
wpi::SmallString< 128 >
wpi::sys::fs::detail::RecDirIterState
Keeps state for the recursive_directory_iterator.
Definition: FileSystem.h:908
wpi::sys::fs::recursive_directory_iterator::level
int level() const
Gets the current level. Starting path is at level 0.
Definition: FileSystem.h:976
ErrorOr.h
wpi::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
wpi::sys::fs::mapped_file_region::const_data
const char * const_data() const
Get a const view of the data.
wpi::sys::fs::detail::DirIterState
Keeps state for the directory_iterator.
Definition: FileSystem.h:842
wpi::sys::fs::basic_file_status::getLastAccessedTime
TimePoint getLastAccessedTime() const
The file access time as reported from the underlying file system.
wpi::sys::fs::recursive_directory_iterator::no_push
void no_push()
Does not go down into the current directory_entry.
Definition: FileSystem.h:1006
wpi::Twine::str
std::string str() const
Return the twine contents as a std::string.
wpi::sys::fs::mapped_file_region::readwrite
May access map via data and modify it. Written to path.
Definition: FileSystem.h:752
wpi::sys::fs::recursive_directory_iterator::pop
void pop()
Goes up one level if Level > 0.
Definition: FileSystem.h:983
wpi::sys::fs::file_status
Represents the result of a call to sys::fs::status().
Definition: FileSystem.h:243
wpi::sys::fs::recursive_directory_iterator::no_push_request
bool no_push_request() const
Returns true if no_push has been called for this directory_entry.
Definition: FileSystem.h:979
wpi::sys::fs::mapped_file_region::mapmode
mapmode
Definition: FileSystem.h:750
wpi::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:85
wpi::sys::fs::mapped_file_region::priv
May modify via data, but changes are lost on destruction.
Definition: FileSystem.h:753