From 57bdcd6bda363fc8df21563597419f12c87f7b15 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Wed, 25 May 2011 15:44:03 -0400 Subject: VWR-25862 Potential fix for caches not clearing when they are supposed to. * Removed leading delimiter from filename mask in all calls to LLDir::deleteFilesInDir() that are related to the viewer asset caches (texture, VFS, and VO). --- indra/newview/llappviewer.cpp | 12 +++++------- indra/newview/lltexturecache.cpp | 4 ++-- indra/newview/llvocache.cpp | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 75b6c18c57..4963fdc170 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3732,14 +3732,12 @@ bool LLAppViewer::initCache() dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""); std::string mask; - mask = gDirUtilp->getDirDelimiter(); - mask += VFS_DATA_FILE_BASE; + mask = VFS_DATA_FILE_BASE; mask += "*"; gDirUtilp->deleteFilesInDir(dir, mask); - mask = gDirUtilp->getDirDelimiter(); - mask += VFS_INDEX_FILE_BASE; + mask = VFS_INDEX_FILE_BASE; mask += "*"; gDirUtilp->deleteFilesInDir(dir, mask); @@ -3805,11 +3803,11 @@ bool LLAppViewer::initCache() void LLAppViewer::purgeCache() { - LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << llendl; + LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << LL_ENDL; LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE); LLVOCache::getInstance()->removeCache(LL_PATH_CACHE); - std::string mask = gDirUtilp->getDirDelimiter() + "*.*"; - gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); + std::string mask = "*.*"; + gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), mask); } std::string LLAppViewer::getSecondLifeTitle() const diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 7fb52c1939..faab6ac002 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1513,12 +1513,12 @@ void LLTextureCache::purgeAllTextures(bool purge_directories) { const char* subdirs = "0123456789abcdef"; std::string delem = gDirUtilp->getDirDelimiter(); - std::string mask = delem + "*"; + std::string mask = "*"; for (S32 i=0; i<16; i++) { std::string dirname = mTexturesDirName + delem + subdirs[i]; llinfos << "Deleting files in directory: " << dirname << llendl; - gDirUtilp->deleteFilesInDir(dirname,mask); + gDirUtilp->deleteFilesInDir(dirname, mask); if (purge_directories) { LLFile::rmdir(dirname); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index c605ddb1c8..99035244a2 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -342,7 +342,7 @@ void LLVOCache::removeCache(ELLPath location) llinfos << "about to remove the object cache due to settings." << llendl ; std::string delem = gDirUtilp->getDirDelimiter(); - std::string mask = delem + "*"; + std::string mask = "*"; std::string cache_dir = gDirUtilp->getExpandedFilename(location, object_cache_dirname); llinfos << "Removing cache at " << cache_dir << llendl; gDirUtilp->deleteFilesInDir(cache_dir, mask); //delete all files @@ -364,7 +364,7 @@ void LLVOCache::removeCache() llinfos << "about to remove the object cache due to some error." << llendl ; std::string delem = gDirUtilp->getDirDelimiter(); - std::string mask = delem + "*"; + std::string mask = "*"; llinfos << "Removing cache at " << mObjectCacheDirName << llendl; gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask); -- cgit v1.2.3 From c2037024596f473ce379e4a073e1ebba745eeed6 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Fri, 27 May 2011 12:55:31 -0400 Subject: VWR-25861 VWR-25862 Removed LLDir_Mac::deleteFilesInDir() virtual method. The LLDir base class method will now be used instead. The handling of the mask parameter was inconsistent between the two implementations, and the failure to remove the old method was probably just an oversight. --- indra/llvfs/lldir_mac.cpp | 32 -------------------------------- indra/llvfs/lldir_mac.h | 1 - 2 files changed, 33 deletions(-) (limited to 'indra') diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp index 8f48f92e2a..489bc3e4a7 100644 --- a/indra/llvfs/lldir_mac.cpp +++ b/indra/llvfs/lldir_mac.cpp @@ -258,38 +258,6 @@ U32 LLDir_Mac::countFilesInDir(const std::string &dirname, const std::string &ma return (file_count); } -S32 LLDir_Mac::deleteFilesInDir(const std::string &dirname, const std::string &mask) -{ - glob_t g; - S32 result = 0; - - std::string tmp_str; - tmp_str = dirname; - tmp_str += mask; - - if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) - { - int i; - - for(i = 0; i < g.gl_pathc; i++) - { -// llinfos << "deleteFilesInDir: deleting number " << i << ", path is " << g.gl_pathv[i] << llendl; - - if(unlink(g.gl_pathv[i]) != 0) - { - result = errno; - - llwarns << "Problem removing " << g.gl_pathv[i] << " - errorcode: " - << result << llendl; - } - } - - globfree(&g); - } - - return(result); -} - std::string LLDir_Mac::getCurPath() { char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ diff --git a/indra/llvfs/lldir_mac.h b/indra/llvfs/lldir_mac.h index bc3f0fac00..d190d70be4 100644 --- a/indra/llvfs/lldir_mac.h +++ b/indra/llvfs/lldir_mac.h @@ -44,7 +44,6 @@ public: /*virtual*/ void initAppDirs(const std::string &app_name, const std::string& app_read_only_data_dir); - virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask); virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); virtual BOOL fileExists(const std::string &filename) const; -- cgit v1.2.3 From 45c8e9bd9a033e568ca0c68c4b217aee684faca9 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Fri, 27 May 2011 15:34:40 -0400 Subject: Removed unneeded platform directory delimeter lookups in llvocache.cpp --- indra/newview/llvocache.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 99035244a2..bbb19a63f1 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -287,8 +287,6 @@ LLVOCache::~LLVOCache() void LLVOCache::setDirNames(ELLPath location) { - std::string delem = gDirUtilp->getDirDelimiter(); - mHeaderFileName = gDirUtilp->getExpandedFilename(location, object_cache_dirname, header_filename); mObjectCacheDirName = gDirUtilp->getExpandedFilename(location, object_cache_dirname); } @@ -341,7 +339,6 @@ void LLVOCache::removeCache(ELLPath location) llinfos << "about to remove the object cache due to settings." << llendl ; - std::string delem = gDirUtilp->getDirDelimiter(); std::string mask = "*"; std::string cache_dir = gDirUtilp->getExpandedFilename(location, object_cache_dirname); llinfos << "Removing cache at " << cache_dir << llendl; @@ -363,7 +360,6 @@ void LLVOCache::removeCache() llinfos << "about to remove the object cache due to some error." << llendl ; - std::string delem = gDirUtilp->getDirDelimiter(); std::string mask = "*"; llinfos << "Removing cache at " << mObjectCacheDirName << llendl; gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask); -- cgit v1.2.3