diff options
author | chai <chaifix@163.com> | 2018-05-17 19:12:18 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-05-17 19:12:18 +0800 |
commit | 9edf2ba9fe8524976d2f298767fff0149e8c0d41 (patch) | |
tree | 38d74676a57de508a40ac581286255c2a18dce12 /src/libjin/fs/filesystem.h | |
parent | 70cdd89e887641b7423e5d4d05928d14ee014aba (diff) |
change file tree
Diffstat (limited to 'src/libjin/fs/filesystem.h')
-rw-r--r-- | src/libjin/fs/filesystem.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/libjin/fs/filesystem.h b/src/libjin/fs/filesystem.h new file mode 100644 index 0000000..8c8ef04 --- /dev/null +++ b/src/libjin/fs/filesystem.h @@ -0,0 +1,55 @@ +#include "buffer.h" +#include "3rdparty/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 |