summaryrefslogtreecommitdiff
path: root/src/client/tile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/tile.cpp')
-rw-r--r--src/client/tile.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index d0b9d81bf..91a3c0a38 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -129,11 +129,12 @@ std::string getTexturePath(const std::string &filename)
/*
Check from texture_path
*/
- const std::string &texture_path = g_settings->get("texture_path");
- if (!texture_path.empty()) {
- std::string testpath = texture_path + DIR_DELIM + filename;
+ for (const auto &path : getTextureDirs()) {
+ std::string testpath = path + DIR_DELIM + filename;
// Check all filename extensions. Returns "" if not found.
fullpath = getImagePath(testpath);
+ if (!fullpath.empty())
+ break;
}
/*
@@ -2388,3 +2389,10 @@ video::ITexture *TextureSource::getShaderFlagsTexture(bool normalmap_present)
return getTexture(tname);
}
+
+const std::vector<std::string> &getTextureDirs()
+{
+ static thread_local std::vector<std::string> dirs =
+ fs::GetRecursiveDirs(g_settings->get("texture_path"));
+ return dirs;
+}