From fdaf0e7eb6b9d9bdd7d5ab5f814f4ebbf791ff67 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 16 May 2018 15:02:43 +0800 Subject: v0.1.0 --- src/fs/filesystem.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/fs/filesystem.h (limited to 'src/fs/filesystem.h') diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h new file mode 100644 index 0000000..fe950e8 --- /dev/null +++ b/src/fs/filesystem.h @@ -0,0 +1,55 @@ +#include "buffer.h" +#include "libs/smount/smount.h" + +namespace jin +{ +namespace fs +{ + + class Filesystem + { + public: + + Filesystem(); + + static Filesystem* get(); + + /** + * is a path a directroy or a single file + */ + bool isDir(const char* path); + + /** + * is a path a directroy or a single file + */ + bool isFile(const char* path); + + /** + * is path a valid path + */ + bool exists(const char* path); + + /** + * read a file and return data buffer + */ + int read(const char* path, Buffer* buffer); + + /** + * set root directory, can only mount once. + */ + void mount(const char* root); + + /** + * convret relative path to absolute path + */ + const char* getFull(const char* path); + + private: + + static Filesystem* fs; + + sm_Shared* S; + + }; +} +} \ No newline at end of file -- cgit v1.1-26-g67d0