diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index 108e455d7..12e4d10c4 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -74,6 +74,9 @@ public: } /// Number of roots size_t numRoots() const { return roots.size(); } + + /// Get the name of the file + std::string getFilename(){ return filename; } }; diff --git a/components/nif/nifstream.hpp b/components/nif/nifstream.hpp index 22d39b8d7..e62193a24 100644 --- a/components/nif/nifstream.hpp +++ b/components/nif/nifstream.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "niftypes.hpp" @@ -142,7 +143,8 @@ public: std::vector str (length+1, 0); if(inp->read(&str[0], length) != length) - throw std::runtime_error ("string length in NIF file does not match"); + throw std::runtime_error (": String length in NIF file "+ file->getFilename() +" does not match! Expected length: " + + Ogre::StringConverter::toString(length)); return &str[0]; }