diff options
Diffstat (limited to 'src/filesystem')
| -rw-r--r-- | src/filesystem/filesystem.cc | 10 | ||||
| -rw-r--r-- | src/filesystem/inifile.cc | 18 | ||||
| -rw-r--r-- | src/filesystem/path.cc | 9 | 
3 files changed, 24 insertions, 13 deletions
| diff --git a/src/filesystem/filesystem.cc b/src/filesystem/filesystem.cc index 5d3ed40..da80ea5 100644 --- a/src/filesystem/filesystem.cc +++ b/src/filesystem/filesystem.cc @@ -13,13 +13,14 @@ std::string filesystem::homedir = "";  std::string filesystem::basedir = "";  std::string filesystem::moddir = ""; -void filesystem::init() { +void filesystem::init() +{  	con_print << "Initializing filesystem..." << std::endl;  	// FIXME datadir should by set by ./configure and read from config.h  	// initialize game data locations -	datadir = "./data/";	 +	datadir = "./data/";  	basedir = "base/";  	moddir = ""; @@ -28,11 +29,12 @@ void filesystem::init() {  	homedir = homedir + "/.osirion/";  	Path::create(homedir);  	Path::create(homedir+basedir); -	if (moddir.size() && !Path::exists(homedir+moddir))  +	if (moddir.size() && !Path::exists(homedir+moddir))  		Path::create(homedir+moddir);  } -void filesystem::shutdown() { +void filesystem::shutdown() +{  	con_print << "Shutting down filesystem..." << std::endl;  } diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc index 57778b3..f04d116 100644 --- a/src/filesystem/inifile.cc +++ b/src/filesystem/inifile.cc @@ -7,13 +7,15 @@  // project headers  #include "filesystem/inifile.h" -namespace filesystem { +namespace filesystem +{  IniFile::IniFile() {}  IniFile::~IniFile() {} -void IniFile::open(const char * filename, std::ios_base::openmode mode) { +void IniFile::open(const char * filename, std::ios_base::openmode mode) +{  	last_read_was_section = false;  	last_read_was_key = false;  	key_current = ""; @@ -25,15 +27,18 @@ void IniFile::open(const char * filename, std::ios_base::openmode mode) {  } -bool IniFile::got_section() const { +bool IniFile::got_section() const +{  	return last_read_was_section;  } -bool IniFile::got_section(const char * sectionlabel) const { +bool IniFile::got_section(const char * sectionlabel) const +{  	return (last_read_was_section && section_current == sectionlabel);  } -IniFile & IniFile::getline() { +IniFile & IniFile::getline() +{  	char line[1024];  	last_read_was_section = false; @@ -79,7 +84,8 @@ IniFile & IniFile::getline() {  	return (*this);  } -bool IniFile::got_key_string(char * const keylabel, std::string & valuestring) { +bool IniFile::got_key_string(char * const keylabel, std::string & valuestring) +{  	//condebug << "IniFile got_value_string " << keylabel << " " << last_read_was_key << std::endl;  	if (last_read_was_key && key_current == keylabel) {  		valuestring.assign(value_current); diff --git a/src/filesystem/path.cc b/src/filesystem/path.cc index c090791..44423b0 100644 --- a/src/filesystem/path.cc +++ b/src/filesystem/path.cc @@ -8,9 +8,11 @@  #include "filesystem/path.h"  #include "sys/sys.h" -namespace filesystem { +namespace filesystem +{ -void Path::create(std::string path) { +void Path::create(std::string path) +{  	std::string tmp(path);  	if (tmp[tmp.size()-1] == '/')  		tmp = tmp.substr(0, tmp.size() - 1); @@ -21,7 +23,8 @@ void Path::create(std::string path) {  		con_debug << "directory created " << tmp << std::endl;  } -bool Path::exists(std::string path) { +bool Path::exists(std::string path) +{  	return false;  } | 
