Commit d0ac6a9c authored by Rogerborg's avatar Rogerborg

Bug #1526176 - use absolute path names when creating / finding textures. As a...

Bug #1526176 - use absolute path names when creating / finding textures.  As a consequence, createAndOpenFile() also needs to use absolute path names in order to match the texture filenames.  Tested on Win32 with all example apps and a small test app attached to the bug.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1673 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 44b37a75
...@@ -204,7 +204,7 @@ namespace video ...@@ -204,7 +204,7 @@ namespace video
//! Renames a texture //! Renames a texture
/** \param texture Pointer to the texture to rename. /** \param texture Pointer to the texture to rename.
\param newName New name for the texture. */ \param newName New name for the texture. This should be a unique name. */
virtual void renameTexture(ITexture* texture, const c8* newName) = 0; virtual void renameTexture(ITexture* texture, const c8* newName) = 0;
//! Creates an empty texture of specified size. //! Creates an empty texture of specified size.
......
...@@ -84,7 +84,9 @@ IReadFile* CFileSystem::createAndOpenFile(const c8* filename) ...@@ -84,7 +84,9 @@ IReadFile* CFileSystem::createAndOpenFile(const c8* filename)
return file; return file;
} }
return createReadFile(filename); // Create the file using an absolute path so that it matches
// the scheme used by CNullDriver::getTexture().
return createReadFile(getAbsolutePath(filename).c_str());
} }
......
...@@ -318,16 +318,19 @@ void CNullDriver::renameTexture(ITexture* texture, const c8* newName) ...@@ -318,16 +318,19 @@ void CNullDriver::renameTexture(ITexture* texture, const c8* newName)
//! loads a Texture //! loads a Texture
ITexture* CNullDriver::getTexture(const c8* filename) ITexture* CNullDriver::getTexture(const c8* filename)
{ {
ITexture* texture = findTexture(filename); // Identify textures by their absolute filenames.
core::stringc absolutePath = FileSystem->getAbsolutePath(filename);
ITexture* texture = findTexture(absolutePath.c_str());
if (texture) if (texture)
return texture; return texture;
io::IReadFile* file = FileSystem->createAndOpenFile(filename); io::IReadFile* file = FileSystem->createAndOpenFile(absolutePath.c_str());
if (file) if (file)
{ {
texture = loadTextureFromFile(file, filename); texture = loadTextureFromFile(file, absolutePath.c_str());
file->drop(); file->drop();
if (texture) if (texture)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment