From 160e1299ef3d95f8e8c48706d7f61dd3dc6c6b60 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 11 Feb 2020 11:29:07 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=20tab=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/filesystem/asset_database.cpp | 134 +++++++++++++++---------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'src/libjin/filesystem/asset_database.cpp') diff --git a/src/libjin/filesystem/asset_database.cpp b/src/libjin/filesystem/asset_database.cpp index e532f41..6214a4a 100644 --- a/src/libjin/filesystem/asset_database.cpp +++ b/src/libjin/filesystem/asset_database.cpp @@ -11,75 +11,75 @@ namespace JinEngine { - namespace Filesystem - { - - AssetDatabase* AssetDatabase::mAssetDatabase = 0; - - AssetDatabase::AssetDatabase() - { - mSmt = smtnewshared(); - } - - AssetDatabase* AssetDatabase::get() - { - return mAssetDatabase ? mAssetDatabase : (mAssetDatabase = new AssetDatabase()); - } - - void AssetDatabase::mount(const char * path) - { - int err = smtmount(mSmt, path); - if (err) - { - printf("%s mounted path %s", smterrstr(err), path); - exit(1); - } - } - - void AssetDatabase::read(const char* path, Buffer& buffer) - { - size_t size; - byte* data = (byte*)smtread(mSmt, path, &size); - if (data == nullptr) - throw Exception("Could not read file %s.", path); - buffer.bind(data, size); - } - - Buffer* read(const char* path) - { - return nullptr; - } - - void* AssetDatabase::read(const char* path, unsigned int* len) - { - return smtread(mSmt, path, len); - } - - const char* AssetDatabase::getFull(const char* path) - { - return smtfullpath(mSmt, path); - } - - bool AssetDatabase::isDir(const char* path) - { - return smtisdir(mSmt, path); - } - - bool AssetDatabase::isFile(const char* path) - { - return smtisreg(mSmt, path); - } - - bool AssetDatabase::exists(const char* path) - { - return smtexists(mSmt, path) == 0; - } + namespace Filesystem + { + + AssetDatabase* AssetDatabase::mAssetDatabase = 0; + + AssetDatabase::AssetDatabase() + { + mSmt = smtnewshared(); + } + + AssetDatabase* AssetDatabase::get() + { + return mAssetDatabase ? mAssetDatabase : (mAssetDatabase = new AssetDatabase()); + } + + void AssetDatabase::mount(const char * path) + { + int err = smtmount(mSmt, path); + if (err) + { + printf("%s mounted path %s", smterrstr(err), path); + exit(1); + } + } + + void AssetDatabase::read(const char* path, Buffer& buffer) + { + size_t size; + byte* data = (byte*)smtread(mSmt, path, &size); + if (data == nullptr) + throw Exception("Could not read file %s.", path); + buffer.bind(data, size); + } + + Buffer* read(const char* path) + { + return nullptr; + } + + void* AssetDatabase::read(const char* path, unsigned int* len) + { + return smtread(mSmt, path, len); + } + + const char* AssetDatabase::getFull(const char* path) + { + return smtfullpath(mSmt, path); + } + + bool AssetDatabase::isDir(const char* path) + { + return smtisdir(mSmt, path); + } + + bool AssetDatabase::isFile(const char* path) + { + return smtisreg(mSmt, path); + } + + bool AssetDatabase::exists(const char* path) + { + return smtexists(mSmt, path) == 0; + } /* - std::vector AssetDatabase::getFiles(const char* path, bool recursive) - { - } + std::vector AssetDatabase::getFiles(const char* path, bool recursive) + { + } */ - } // namespace Filesystem + } // namespace Filesystem } // namespace JinEngine #endif // jin_filesystem \ No newline at end of file -- cgit v1.1-26-g67d0