aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Filesystem
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Filesystem')
-rw-r--r--src/libjin/Filesystem/je_asset_database.cpp68
-rw-r--r--src/libjin/Filesystem/je_asset_database.h (renamed from src/libjin/Filesystem/je_filesystem.h)16
-rw-r--r--src/libjin/Filesystem/je_buffer.h8
-rw-r--r--src/libjin/Filesystem/je_filesystem.cpp68
4 files changed, 80 insertions, 80 deletions
diff --git a/src/libjin/Filesystem/je_asset_database.cpp b/src/libjin/Filesystem/je_asset_database.cpp
new file mode 100644
index 0000000..c945d6a
--- /dev/null
+++ b/src/libjin/Filesystem/je_asset_database.cpp
@@ -0,0 +1,68 @@
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h> /* defines FILENAME_MAX */
+
+#include "je_asset_database.h"
+
+namespace JinEngine
+{
+ namespace Filesystem
+ {
+
+ AssetDatabase* AssetDatabase::fs = 0;
+
+ AssetDatabase::AssetDatabase()
+ {
+ S = smtnewshared();
+ }
+
+ AssetDatabase* AssetDatabase::get()
+ {
+ return fs ? fs : (fs = new AssetDatabase());
+ }
+
+ void AssetDatabase::mount(const char * path)
+ {
+ int err = smtmount(S, path);
+ if (err)
+ {
+ printf("%s mounted path %s", smterrstr(err), path);
+ exit(1);
+ }
+ }
+
+ int AssetDatabase::read(const char* path, Buffer* buffer)
+ {
+ buffer->data = smtread(S, path, &buffer->size);
+ if (buffer->data == 0)
+ return 0;
+ return 1;
+ }
+
+ void* AssetDatabase::read(const char* path, unsigned int* len)
+ {
+ return smtread(S, path, len);
+ }
+
+ const char* AssetDatabase::getFull(const char* path)
+ {
+ return smtfullpath(S, path);
+ }
+
+ bool AssetDatabase::isDir(const char* path)
+ {
+ return smtisdir(S, path);
+ }
+
+ bool AssetDatabase::isFile(const char* path)
+ {
+ return smtisreg(S, path);
+ }
+
+ bool AssetDatabase::exists(const char* path)
+ {
+ return smtexists(S, path) == 0;
+ }
+
+ } // namespace Filesystem
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Filesystem/je_filesystem.h b/src/libjin/Filesystem/je_asset_database.h
index 5d65fea..ef16263 100644
--- a/src/libjin/Filesystem/je_filesystem.h
+++ b/src/libjin/Filesystem/je_asset_database.h
@@ -1,17 +1,17 @@
#include "je_buffer.h"
#include "../3rdparty/smount/smount.h"
-namespace jin
+namespace JinEngine
{
- namespace filesystem
+ namespace Filesystem
{
/* Դ */
- class Filesystem
+ class AssetDatabase
{
public:
- static Filesystem* get();
+ static AssetDatabase* get();
- Filesystem();
+ AssetDatabase();
bool isDir(const char* path);
bool isFile(const char* path);
@@ -22,10 +22,10 @@ namespace jin
const char* getFull(const char* path);
private:
- static Filesystem* fs;
+ static AssetDatabase* fs;
smtShared* S;
};
- } // namespace filesystem
-} // namespace jin \ No newline at end of file
+ } // namespace Filesystem
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Filesystem/je_buffer.h b/src/libjin/Filesystem/je_buffer.h
index 6ac9f4a..11faf79 100644
--- a/src/libjin/Filesystem/je_buffer.h
+++ b/src/libjin/Filesystem/je_buffer.h
@@ -4,9 +4,9 @@
#include <string.h>
#include <stdlib.h>
-namespace jin
+namespace JinEngine
{
- namespace filesystem
+ namespace Filesystem
{
/**
@@ -61,7 +61,7 @@ namespace jin
};
- } // namespace filesystem
-} // namespace jin
+ } // namespace Filesystem
+} // namespace JinEngine
#endif \ No newline at end of file
diff --git a/src/libjin/Filesystem/je_filesystem.cpp b/src/libjin/Filesystem/je_filesystem.cpp
deleted file mode 100644
index 339d470..0000000
--- a/src/libjin/Filesystem/je_filesystem.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h> /* defines FILENAME_MAX */
-
-#include "je_filesystem.h"
-
-namespace jin
-{
- namespace filesystem
- {
-
- Filesystem* Filesystem::fs = 0;
-
- Filesystem::Filesystem()
- {
- S = smtnewshared();
- }
-
- Filesystem* Filesystem::get()
- {
- return fs ? fs : (fs = new Filesystem());
- }
-
- void Filesystem::mount(const char * path)
- {
- int err = smtmount(S, path);
- if (err)
- {
- printf("%s mounted path %s", smterrstr(err), path);
- exit(1);
- }
- }
-
- int Filesystem::read(const char* path, Buffer* buffer)
- {
- buffer->data = smtread(S, path, &buffer->size);
- if (buffer->data == 0)
- return 0;
- return 1;
- }
-
- void* Filesystem::read(const char* path, unsigned int* len)
- {
- return smtread(S, path, len);
- }
-
- const char* Filesystem::getFull(const char* path)
- {
- return smtfullpath(S, path);
- }
-
- bool Filesystem::isDir(const char* path)
- {
- return smtisdir(S, path);
- }
-
- bool Filesystem::isFile(const char* path)
- {
- return smtisreg(S, path);
- }
-
- bool Filesystem::exists(const char* path)
- {
- return smtexists(S, path) == 0;
- }
-
- } // namespace filesystem
-} // namespace jin \ No newline at end of file