From 26666bb36f594bbca8aa71654c009bbceb1e5eb8 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 25 Mar 2012 12:10:58 +0300 Subject: [PATCH] Add more media directories; mod/{textures,sounds,media} --- src/server.cpp | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/server.cpp b/src/server.cpp index d6bb14f9..13a8ebf7 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3931,29 +3931,40 @@ void Server::fillMediaCache() { DSTACK(__FUNCTION_NAME); - infostream<<"Server: Calculating file checksums"< paths; for(core::list::Iterator i = m_mods.begin(); i != m_mods.end(); i++){ const ModSpec &mod = *i; - std::string filepath = mod.path + DIR_DELIM + "textures"; - std::vector dirlist = fs::GetDirListing(filepath); + paths.push_back(mod.path + DIR_DELIM + "textures"); + paths.push_back(mod.path + DIR_DELIM + "sounds"); + paths.push_back(mod.path + DIR_DELIM + "media"); + } + + // Collect media file information from paths into cache + for(std::list::iterator i = paths.begin(); + i != paths.end(); i++) + { + std::string mediapath = *i; + std::vector dirlist = fs::GetDirListing(mediapath); for(u32 j=0; jm_media[tname] = MediaInfo(tpath,digest_string); - verbosestream<<"Server: sha1 for "<m_media[filename] = MediaInfo(filepath, digest_string); + verbosestream<<"Server: sha1 for "<