aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/file.cpp6
-rw-r--r--common/file.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/common/file.cpp b/common/file.cpp
index 6b9e3fd3da..583a3f79c9 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -86,9 +86,11 @@ File::File() {
_handle = NULL;
_ioFailed = false;
_encbyte = 0;
+ _name = 0;
}
File::~File() {
+ delete [] _name;
close();
}
@@ -123,6 +125,10 @@ bool File::open(const char *filename, const char *directory, int mode, byte encb
}
_encbyte = encbyte;
+
+ int len = strlen(filename);
+ _name = new char[len+1];
+ memcpy(_name, filename, len+1);
return true;
}
diff --git a/common/file.h b/common/file.h
index b2863fc03d..fd6581c192 100644
--- a/common/file.h
+++ b/common/file.h
@@ -32,6 +32,7 @@ private:
FILE * _handle;
bool _ioFailed;
byte _encbyte;
+ char *_name; // For debugging
FILE *fopenNoCase(const char *filename, const char *directory, const char *mode);
@@ -51,6 +52,7 @@ public:
bool eof();
uint32 pos();
uint32 size();
+ const char *name() const { return _name; }
void seek(int32 offs, int whence);
uint32 read(void *ptr, uint32 size);
byte readByte();