diff options
author | Max Horn | 2002-12-24 02:02:53 +0000 |
---|---|---|
committer | Max Horn | 2002-12-24 02:02:53 +0000 |
commit | 7692091a9cc1d53400f5fe704d14e713ccf8b0ac (patch) | |
tree | 7aad437fe645e4a42fa373c9eda2cbb9310ec1c1 /common | |
parent | 2da14e0fa16772647bdf279936e834a4dd35b443 (diff) | |
download | scummvm-rg350-7692091a9cc1d53400f5fe704d14e713ccf8b0ac.tar.gz scummvm-rg350-7692091a9cc1d53400f5fe704d14e713ccf8b0ac.tar.bz2 scummvm-rg350-7692091a9cc1d53400f5fe704d14e713ccf8b0ac.zip |
File object stores file name (useful for debugging)
svn-id: r6089
Diffstat (limited to 'common')
-rw-r--r-- | common/file.cpp | 6 | ||||
-rw-r--r-- | common/file.h | 2 |
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(); |