namespace Utils
{
+/**
+ * @brief removed a file entry from file system (if existing).
+ * @param path path to be removed.
+ * @return @a true if the file was successfully deleted.
+ */
bool unlink( const std::string& path );
+/**
+ * @brief represents a file(/path) status.
+ *
+ * This is basically a wrapper around the "stat" call.
+ */
class FileStat
{
public:
- FileStat( const std::string& path);
+ FileStat( const std::string& path, bool follow_symlinks= true );
~FileStat();
+ /**
+ * @brief stat the path again and updates the values.
+ */
void refresh();
+ /**
+ * @brief returns if the stat values are valid.
+ * @return @a true if the stat values are valid.
+ */
bool is_valid() const { return m_is_valid; }
operator bool() const { return m_is_valid; }
bool is_regular_file() const { return m_is_regular_file; }
bool is_directory() const { return m_is_directory; }
+ bool is_character_device() const { return m_is_character_device; }
+ bool is_block_device() const { return m_is_block_device; }
+ bool is_fifo() const { return m_is_fifo; }
+ bool is_symbolic_link() const { return m_is_symbolic_link; }
+ bool is_link() const { return m_is_symbolic_link; }
+ bool is_socket() const { return m_is_socket; }
private:
std::string m_path;
+ bool m_follow_symlinks;
bool m_is_valid;
bool m_is_regular_file;
bool m_is_directory;
+ bool m_is_character_device;
+ bool m_is_block_device;
+ bool m_is_fifo;
+ bool m_is_symbolic_link;
+ bool m_is_socket;
}; // end of FileStat
} // end of namespace Utils
-}// end of namespace AsyncIo
+} // end of namespace AsyncIo
#endif