]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/stat.h
Change stat functions so that it's again possible to determine file existence
[libs/core.git] / source / fs / stat.h
index 0d5f6de184b6f7a725e648119172573125799375..6ae551fd13836955bbd6a11f347a2b236abe0022 100644 (file)
@@ -30,6 +30,7 @@ class Stat
 private:
        struct Private;
 
+       bool exists;
        FileType type;
        FileSize size;
        FileSize alloc_size;
@@ -37,8 +38,9 @@ private:
        std::string owner;
        std::string group;
 
-       Stat();
 public:
+       Stat();
+
        FileType get_type() const { return type; }
        bool is_regular() const { return type==REGULAR; }
        bool is_directory() const { return type==DIRECTORY; }
@@ -49,6 +51,8 @@ public:
        const std::string &get_owner() const { return owner; }
        const std::string &get_group() const { return group; }
 
+       operator bool() const { return exists; }
+
        /// Returns a Stat object describing a file.
        static Stat stat(const Path &);
        static Stat lstat(const Path &);