diff options
author | chai <chaifix@163.com> | 2018-10-20 15:50:06 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-20 15:50:06 +0800 |
commit | e9410bd371fc68169c57d2c52382948a0b083da4 (patch) | |
tree | d8f7e600b4ffd6a5c4c9a30f68f9ee74b8491c3b /src/libjin/Filesystem/je_asset_database.cpp | |
parent | 58ad98213763348b49d8313675203b287a5442bb (diff) |
*修改名称空间
Diffstat (limited to 'src/libjin/Filesystem/je_asset_database.cpp')
-rw-r--r-- | src/libjin/Filesystem/je_asset_database.cpp | 68 |
1 files changed, 68 insertions, 0 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 |