aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Filesystem/Filesystem.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-07-26 23:58:12 +0800
committerchai <chaifix@163.com>2018-07-26 23:58:12 +0800
commit1a882936e91826e4d69584745e16a79650272015 (patch)
tree61572b11d766fcb8cfa9e98f001c5fecc5712d7c /src/libjin/Filesystem/Filesystem.h
parent977b845c3e09a5b51895be81ef7514ae4030f588 (diff)
*change name
Diffstat (limited to 'src/libjin/Filesystem/Filesystem.h')
-rw-r--r--src/libjin/Filesystem/Filesystem.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/libjin/Filesystem/Filesystem.h b/src/libjin/Filesystem/Filesystem.h
new file mode 100644
index 0000000..15f0b9f
--- /dev/null
+++ b/src/libjin/Filesystem/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;
+
+ smtShared* S;
+
+ };
+}
+} \ No newline at end of file