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.cpp14
-rw-r--r--src/libjin/Filesystem/je_asset_database.h10
-rw-r--r--src/libjin/Filesystem/je_buffer.h4
3 files changed, 14 insertions, 14 deletions
diff --git a/src/libjin/Filesystem/je_asset_database.cpp b/src/libjin/Filesystem/je_asset_database.cpp
index ac547f0..a8524c5 100644
--- a/src/libjin/Filesystem/je_asset_database.cpp
+++ b/src/libjin/Filesystem/je_asset_database.cpp
@@ -5,6 +5,8 @@
#include <stdlib.h>
#include <stdio.h> /* defines FILENAME_MAX */
+#include "../common/je_exception.h"
+
#include "je_asset_database.h"
namespace JinEngine
@@ -34,14 +36,13 @@ namespace JinEngine
}
}
- bool AssetDatabase::read(const char* path, Buffer& buffer)
+ void AssetDatabase::read(const char* path, Buffer& buffer)
{
size_t size;
byte* data = (byte*)smtread(mSmt, path, &size);
- if (data == nullptr)
- return false;
+ if (data == nullptr)
+ throw Exception("Could not read file %s.", path);
buffer.bind(data, size);
- return true;
}
Buffer* read(const char* path)
@@ -73,12 +74,11 @@ namespace JinEngine
{
return smtexists(mSmt, path) == 0;
}
-
+/*
std::vector<std::string> AssetDatabase::getFiles(const char* path, bool recursive)
{
-
}
-
+*/
} // namespace Filesystem
} // namespace JinEngine
diff --git a/src/libjin/Filesystem/je_asset_database.h b/src/libjin/Filesystem/je_asset_database.h
index 8c30fc1..e8b1bd1 100644
--- a/src/libjin/Filesystem/je_asset_database.h
+++ b/src/libjin/Filesystem/je_asset_database.h
@@ -1,12 +1,12 @@
-#ifndef __JE_ASSET_DATABASE_H
-#define __JE_ASSET_DATABASE_H
+#ifndef __JE_ASSET_DATABASE_H__
+#define __JE_ASSET_DATABASE_H__
#include "../core/je_configuration.h"
#if defined(jin_filesystem)
#include <vector>
-#include "../3rdparty/smount/smount.h"
+#include "smount/smount.h"
#include "je_buffer.h"
@@ -70,7 +70,7 @@ namespace JinEngine
/// @param buffer Buffer to fill.
/// @return True if read sucessful, otherwise return false.
///
- bool read(const char* path, Buffer& buffer);
+ void read(const char* path, Buffer& buffer);
///
/// Read file and return data content.
@@ -88,7 +88,7 @@ namespace JinEngine
/// @param recursive Recursivily search folder.
/// @return File list under given directory.
///
- std::vector<std::string> getFiles(const char* path, bool recursive);
+ std::vector<std::string> getFiles(const char* directory, bool recursive = false);
///
/// Get full path of asset.
diff --git a/src/libjin/Filesystem/je_buffer.h b/src/libjin/Filesystem/je_buffer.h
index 0726e1d..1111e49 100644
--- a/src/libjin/Filesystem/je_buffer.h
+++ b/src/libjin/Filesystem/je_buffer.h
@@ -1,5 +1,5 @@
-#ifndef __JE_BUFFER_H
-#define __JE_BUFFER_H
+#ifndef __JE_BUFFER_H__
+#define __JE_BUFFER_H__
#include "../core/je_configuration.h"
#if defined(jin_filesystem)