From 62d64847c4ebb1cff5a84748d4205ee088484b16 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Thu, 9 Mar 2017 18:41:35 -0500 Subject: [PATCH] Fix texture paths on case-sensitive file systems, fixes #2807 --- src/graphics/material.cpp | 8 ++++---- src/graphics/material.hpp | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/graphics/material.cpp b/src/graphics/material.cpp index dddb076f8..ce40bad83 100644 --- a/src/graphics/material.cpp +++ b/src/graphics/material.cpp @@ -72,7 +72,7 @@ Material::Material(const XMLNode *node, bool deprecated) if (relativePath.size() == 0) Log::warn("Material", "Cannot determine texture full path : <%s>", m_texname.c_str()); else - m_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str(); + m_full_path = m_original_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str(); core::stringc texfname(m_texname.c_str()); texfname.make_lower(); @@ -435,12 +435,12 @@ Material::Material(const std::string& fname, bool is_full_path, if (is_full_path) { m_texname = StringUtils::getBasename(fname); - m_full_path = fname; + m_full_path = m_original_full_path = fname; } else { m_texname = fname; - m_full_path = file_manager->getFileSystem()->getAbsolutePath( + m_full_path = m_original_full_path = file_manager->getFileSystem()->getAbsolutePath( file_manager->searchTexture(m_texname).c_str()).c_str(); } @@ -527,7 +527,7 @@ void Material::install(bool srgb, bool premul_alpha) else { m_texture = STKTexManager::getInstance()->getTexture - (m_full_path, srgb, premul_alpha, false/*set_material*/, + (m_original_full_path, srgb, premul_alpha, false/*set_material*/, srgb/*mesh_tex*/); } diff --git a/src/graphics/material.hpp b/src/graphics/material.hpp index c8df14cff..c8f52aa5b 100644 --- a/src/graphics/material.hpp +++ b/src/graphics/material.hpp @@ -91,6 +91,8 @@ private: std::string m_texname; std::string m_full_path; + + std::string m_original_full_path; /** Name of a special sfx to play when a kart is on this terrain, or * "" if no special sfx exists. */