From 37e7b276dbd2072ea932bdd1e5b2d74c5e77aef0 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Fri, 19 Jul 2013 10:33:17 -0500 Subject: [PATCH] Avoid crash if main cache directory does not exist. --- indra/newview/lltexturecache.cpp | 5 +++++ indra/newview/lltexturecache.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 3918b5a7ae..4f17a3fe19 100755 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -922,6 +922,7 @@ void LLTextureCache::setDirNames(ELLPath location) { std::string delem = gDirUtilp->getDirDelimiter(); + mCacheParentDirName = gDirUtilp->getExpandedFilename(location,""); mHeaderEntriesFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, entries_filename); mHeaderDataFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, cache_filename); mTexturesDirName = gDirUtilp->getExpandedFilename(location, textures_dirname); @@ -998,6 +999,10 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache if (!mReadOnly) { + if (!LLFile::isdir(mCacheParentDirName)) + { + LLFile::mkdir(mCacheParentDirName); + } LLFile::mkdir(mTexturesDirName); const char* subdirs = "0123456789abcdef"; diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 9b266a2805..eebcecf05b 100755 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -201,6 +201,8 @@ private: responder_list_t mCompletedList; BOOL mReadOnly; + + std::string mCacheParentDirName; // HEADERS (Include first mip) std::string mHeaderEntriesFileName;