Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/console.h2
-rw-r--r--src/common/file.cc5
-rw-r--r--src/common/file.h7
3 files changed, 11 insertions, 3 deletions
diff --git a/src/common/console.h b/src/common/console.h
index 5f80e73..b661afc 100644
--- a/src/common/console.h
+++ b/src/common/console.h
@@ -15,6 +15,8 @@
/// global define to send a warning message to the system console
#define conwarn common::Console::instance->warning()
+#define DEBUG 1
+
#ifdef DEBUG
/// global define to send a debug message to the system console
#define condebug common::Console::instance->debug()
diff --git a/src/common/file.cc b/src/common/file.cc
index 822c678..73537ec 100644
--- a/src/common/file.cc
+++ b/src/common/file.cc
@@ -17,6 +17,7 @@ std::string File::moddir = "";
void File::open(const char * filename, ios_base::openmode mode)
{
+ file_name.assign(filename);
std::string fn;
// if moddir is set, try the mods subdir first
@@ -58,9 +59,9 @@ void File::open(const char * filename, ios_base::openmode mode)
std::ifstream::open(fn.c_str(), mode);
if (!this->is_open()) {
- condebug << "File could not open " << filename << std::endl;
+ conmesg << "File could not open " << filename << std::endl;
} else {
- conmesg << "File opened " << fn << std::endl;
+ condebug << "File opened " << fn << std::endl;
}
}
diff --git a/src/common/file.h b/src/common/file.h
index a377981..842450e 100644
--- a/src/common/file.h
+++ b/src/common/file.h
@@ -18,7 +18,10 @@ class File : public std::ifstream
{
public:
/// open the file for reading
- void open(const char * filename, std::ios_base::openmode mode = std::ios_base::in );
+ virtual void open(const char * filename, std::ios_base::openmode mode = std::ios_base::in );
+
+ /// current filename
+ inline std::string name() { return file_name; }
/// location of the main data files, includes trailing /
static std::string datadir;
@@ -28,6 +31,8 @@ public:
static std::string basedir;
/// subdirectory for the current mod, includes trailing /
static std::string moddir;
+private:
+ std::string file_name;
}; // class File
} // namespace common