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/inifile.cc8
-rw-r--r--src/filesystem/inifile.h5
2 files changed, 8 insertions, 5 deletions
diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc
index d9f2839..337cf45 100644
--- a/src/filesystem/inifile.cc
+++ b/src/filesystem/inifile.cc
@@ -16,7 +16,7 @@ IniFile::IniFile() {}
IniFile::~IniFile() {}
-void IniFile::open(std::string const & name) {
+bool IniFile::open(std::string const & name) {
last_read_was_section = false;
last_read_was_key = false;
@@ -32,7 +32,7 @@ void IniFile::open(std::string const & name) {
filesystem::File *f = filesystem::open(inifile_name.c_str());
if (!f) {
con_warn << "Could not open " << inifile_name << std::endl;
- return;
+ return false;
}
std::string fn = f->path();
@@ -42,8 +42,10 @@ void IniFile::open(std::string const & name) {
inifile_ifs.open(fn.c_str());
if (!inifile_ifs.is_open()) {
con_warn << "Could not stream " << fn << "!\n";
- return;
+ return false;
}
+
+ return true;
}
diff --git a/src/filesystem/inifile.h b/src/filesystem/inifile.h
index 6503053..f5c903d 100644
--- a/src/filesystem/inifile.h
+++ b/src/filesystem/inifile.h
@@ -24,13 +24,14 @@ namespace filesystem {
class IniFile {
public:
IniFile();
- virtual ~IniFile();
+ ~IniFile();
/// open the file for reading
/** the filename will get the "ini/" prefix and ".ini" suffix
*/
- virtual void open(std::string const & name);
+ bool open(std::string const & name);
+ /// parse one line, returns false on end-of-file
bool getline();
/// current section label