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