aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Filesystem
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Filesystem')
-rw-r--r--src/libjin/Filesystem/Buffer.h18
-rw-r--r--src/libjin/Filesystem/Filesystem.cpp10
-rw-r--r--src/libjin/Filesystem/Filesystem.h34
3 files changed, 10 insertions, 52 deletions
diff --git a/src/libjin/Filesystem/Buffer.h b/src/libjin/Filesystem/Buffer.h
index 1d72083..ad16c12 100644
--- a/src/libjin/Filesystem/Buffer.h
+++ b/src/libjin/Filesystem/Buffer.h
@@ -11,26 +11,20 @@ namespace filesystem
class Buffer
{
public:
-
- inline Buffer(): data(0), size(0)
- {
- }
-
- inline Buffer(const Buffer& src)
+ Buffer() : data(0), size(0) {}
+ Buffer(const Buffer& src)
{
delete data;
size = src.size;
data = new char[size];
memcpy(data, src.data, size);
}
-
inline Buffer(void* d, int s)
{
data = new char(size);
memcpy(data, d, size);
size = s;
}
-
inline ~Buffer()
{
size = 0;
@@ -38,16 +32,12 @@ namespace filesystem
}
public:
-
- // data position in memory
void* data;
-
- // data buffer size
unsigned int size;
};
-}
-}
+} // filesystem
+} // jin
#endif \ No newline at end of file
diff --git a/src/libjin/Filesystem/Filesystem.cpp b/src/libjin/Filesystem/Filesystem.cpp
index e9b05e3..8089c9d 100644
--- a/src/libjin/Filesystem/Filesystem.cpp
+++ b/src/libjin/Filesystem/Filesystem.cpp
@@ -20,9 +20,6 @@ namespace filesystem
return fs ? fs : (fs = new Filesystem());
}
- /**
- * r is relative path
- */
void Filesystem::mount(const char * path)
{
int err = smtmount(S, path);
@@ -33,9 +30,6 @@ namespace filesystem
}
}
- /**
- *
- */
int Filesystem::read(const char* path, Buffer* buffer)
{
buffer->data = smtread(S, path, &buffer->size);
@@ -64,5 +58,5 @@ namespace filesystem
return smtexists(S, path) == 0;
}
-}
-} \ No newline at end of file
+} // filesystem
+} // jin \ No newline at end of file
diff --git a/src/libjin/Filesystem/Filesystem.h b/src/libjin/Filesystem/Filesystem.h
index ba0fdc5..f2e39af 100644
--- a/src/libjin/Filesystem/Filesystem.h
+++ b/src/libjin/Filesystem/Filesystem.h
@@ -9,48 +9,22 @@ namespace filesystem
class Filesystem
{
public:
-
- Filesystem();
-
static Filesystem* get();
- /**
- * is a path a directroy or a single file
- */
- bool isDir(const char* path);
+ Filesystem();
- /**
- * is a path a directroy or a single file
- */
+ bool isDir(const char* path);
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
+} // filesystem
+} // jin \ No newline at end of file