5 #include <msp/time/timestamp.h>
20 typedef __uint64 FileSize;
22 typedef unsigned long long FileSize;
26 Holds file information.
37 Time::TimeStamp mtime;
44 FileType get_type() const { return type; }
45 bool is_regular() const { return type==REGULAR; }
46 bool is_directory() const { return type==DIRECTORY; }
47 bool is_symlink() const { return type==SYMLINK; }
48 FileSize get_size() const { return size; }
49 FileSize get_alloc_size() const { return alloc_size; }
50 const Time::TimeStamp &get_modify_time() const { return mtime; }
51 const std::string &get_owner() const { return owner; }
52 const std::string &get_group() const { return group; }
54 operator bool() const { return exists; }
56 /// Returns a Stat object describing a file.
57 static Stat stat(const Path &);
58 static Stat lstat(const Path &);
61 /// Convenience wrapper for Stat::stat
62 inline Stat stat(const Path &path)
63 { return Stat::stat(path); }
65 /// Convenience wrapper for Stat::lstat
66 inline Stat lstat(const Path &path)
67 { return Stat::lstat(path); }
69 /// Tests for existence of a file
70 bool exists(const Path &path);
72 /// Tests whether a path refers to an existing regular file
73 inline bool is_reg(const Path &path)
74 { return stat(path).is_regular(); }
76 /// Tests whether a path refers to an existing directory
77 inline bool is_dir(const Path &path)
78 { return stat(path).is_directory(); }
80 /// Tests whether a path refers to a symbolic link
81 inline bool is_link(const Path &path)
82 { return lstat(path).is_symlink(); }