Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/filesystem')
-rw-r--r--src/filesystem/Makefile.am3
-rw-r--r--src/filesystem/file.cc4
-rw-r--r--src/filesystem/file.h3
-rw-r--r--src/filesystem/filesystem.cc15
-rw-r--r--src/filesystem/filesystem.h1
-rw-r--r--src/filesystem/inifile.cc4
-rw-r--r--src/filesystem/inifile.h10
7 files changed, 34 insertions, 6 deletions
diff --git a/src/filesystem/Makefile.am b/src/filesystem/Makefile.am
index 9ef09bd..c072b02 100644
--- a/src/filesystem/Makefile.am
+++ b/src/filesystem/Makefile.am
@@ -3,8 +3,7 @@ METASOURCES = AUTO
libfilesystem_la_SOURCES = file.cc filesystem.cc inifile.cc path.cc
libfilesystem_la_LDFLAGS = -avoid-version -no-undefined
libfilesystem_la_LIBADD = $(top_builddir)/src/common/libcommon.la
-
noinst_LTLIBRARIES = libfilesystem.la
-noinst_HEADERS = file.h filesystem.h path.h
+noinst_HEADERS = file.h filesystem.h inifile.h path.h
INCLUDES = -I$(top_srcdir)/src
diff --git a/src/filesystem/file.cc b/src/filesystem/file.cc
index 7f33337..4e68bbd 100644
--- a/src/filesystem/file.cc
+++ b/src/filesystem/file.cc
@@ -10,6 +10,10 @@
namespace filesystem {
+File::File() {}
+
+File::~File() {}
+
void File::open(const char * filename, ios_base::openmode mode) {
file_name.assign(filename);
std::string fn;
diff --git a/src/filesystem/file.h b/src/filesystem/file.h
index 5e997a2..aaafd01 100644
--- a/src/filesystem/file.h
+++ b/src/filesystem/file.h
@@ -16,6 +16,9 @@ namespace filesystem {
/// a class to open data files
class File : public std::ifstream {
public:
+ File();
+ virtual ~File();
+
/// open the file for reading
virtual void open(const char * filename, std::ios_base::openmode mode = std::ios_base::in);
diff --git a/src/filesystem/filesystem.cc b/src/filesystem/filesystem.cc
index 9c00930..5ae4da7 100644
--- a/src/filesystem/filesystem.cc
+++ b/src/filesystem/filesystem.cc
@@ -15,6 +15,21 @@ std::string filesystem::moddir = "";
void filesystem::init() {
con_debug << "Initializing filesystem..." << std::endl;
+
+ // FIXME datadir should by set by ./configure and read from config.h
+
+ // initialize game data locations
+ datadir = "./data/";
+ basedir = "base/";
+ moddir = "";
+
+ // FIXME win32
+ homedir = getenv("HOME");
+ homedir = homedir + "/.osirion/";
+ Path::create(homedir);
+ Path::create(homedir+basedir);
+ if (moddir.size() && !Path::exists(homedir+moddir))
+ Path::create(homedir+moddir);
}
void filesystem::shutdown() {
diff --git a/src/filesystem/filesystem.h b/src/filesystem/filesystem.h
index 4032575..e1ff8c6 100644
--- a/src/filesystem/filesystem.h
+++ b/src/filesystem/filesystem.h
@@ -33,6 +33,7 @@ void shutdown();
// project headers
#include "filesystem/file.h"
#include "filesystem/path.h"
+#include "filesystem/inifile.h"
#endif // __INCLUDED_FILYSYSTEM_H__
diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc
index 308a87d..57778b3 100644
--- a/src/filesystem/inifile.cc
+++ b/src/filesystem/inifile.cc
@@ -9,6 +9,10 @@
namespace filesystem {
+IniFile::IniFile() {}
+
+IniFile::~IniFile() {}
+
void IniFile::open(const char * filename, std::ios_base::openmode mode) {
last_read_was_section = false;
last_read_was_key = false;
diff --git a/src/filesystem/inifile.h b/src/filesystem/inifile.h
index f5b74a3..d3984c5 100644
--- a/src/filesystem/inifile.h
+++ b/src/filesystem/inifile.h
@@ -17,12 +17,15 @@
namespace filesystem {
/// a class to read .ini files
-/*! The IniFile class provides functions to read .ini files. A .ini file
+/** The IniFile class provides functions to read .ini files. A .ini file
* consists of one or more [section] headers followed by one or more key=value
* pairs. Lines starting with # or ; are considered comments
*/
class IniFile : public File {
public:
+ IniFile();
+ virtual ~IniFile();
+
/// open the file for reading
virtual void open(const char * filename, std::ios_base::openmode mode = std::ios_base::in);
@@ -68,9 +71,8 @@ private:
bool last_read_was_section;
unsigned int line_number;
-}
-; // class IniFile
+};
-} // namespace common
+}
#endif // __INCLUDED_FILESYSTEM_INIFILE_H__