MAINT-141, MAINT-95, MAINT-62 FIXED Don't delete files using masks starting with "/".
Encountering such a mask will show a warning message and throw a debug assertion.meow-7.2.2
parent
aa4ccff19f
commit
7b4d05894d
|
|
@ -751,7 +751,7 @@ void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state)
|
|||
else if ((!strcmp(argv[i], "--image-dir")) && (++i < argc))
|
||||
{
|
||||
app_state->image_dir = argv[i];
|
||||
app_state->image_dir_iter = new LLDirIterator(argv[i], "/*.jpg");
|
||||
app_state->image_dir_iter = new LLDirIterator(argv[i], "*.jpg");
|
||||
}
|
||||
else if ((!strcmp(argv[i], "--dest")) && (++i < argc))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,6 +86,13 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask)
|
|||
std::string fullpath;
|
||||
S32 result;
|
||||
|
||||
// File masks starting with "/" will match nothing, so we consider them invalid.
|
||||
if (LLStringUtil::startsWith(mask, getDirDelimiter()))
|
||||
{
|
||||
llwarns << "Invalid file mask: " << mask << llendl;
|
||||
llassert(!"Invalid file mask");
|
||||
}
|
||||
|
||||
LLDirIterator iter(dirname, mask);
|
||||
while (iter.next(filename))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1188,9 +1188,7 @@ void *updatethreadproc(void*)
|
|||
|
||||
llinfos << "Clearing cache..." << llendl;
|
||||
|
||||
char mask[LL_MAX_PATH]; /* Flawfinder: ignore */
|
||||
snprintf(mask, LL_MAX_PATH, "%s*.*", gDirUtilp->getDirDelimiter().c_str());
|
||||
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask);
|
||||
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*");
|
||||
|
||||
llinfos << "Clear complete." << llendl;
|
||||
|
||||
|
|
|
|||
|
|
@ -1512,7 +1512,6 @@ bool LLAppViewer::cleanup()
|
|||
if (! isError())
|
||||
{
|
||||
std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
|
||||
logdir += gDirUtilp->getDirDelimiter();
|
||||
gDirUtilp->deleteFilesInDir(logdir, "*-*-*-*-*.dmp");
|
||||
}
|
||||
|
||||
|
|
@ -1761,8 +1760,7 @@ bool LLAppViewer::cleanup()
|
|||
if (mPurgeOnExit)
|
||||
{
|
||||
llinfos << "Purging all cache files on exit" << llendflush;
|
||||
std::string mask = gDirUtilp->getDirDelimiter() + "*.*";
|
||||
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask);
|
||||
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*");
|
||||
}
|
||||
|
||||
removeMarkerFile(); // Any crashes from here on we'll just have to ignore
|
||||
|
|
@ -2996,8 +2994,7 @@ void LLAppViewer::cleanupSavedSettings()
|
|||
|
||||
void LLAppViewer::removeCacheFiles(const std::string& file_mask)
|
||||
{
|
||||
std::string mask = gDirUtilp->getDirDelimiter() + file_mask;
|
||||
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), mask);
|
||||
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), file_mask);
|
||||
}
|
||||
|
||||
void LLAppViewer::writeSystemInfo()
|
||||
|
|
@ -3856,8 +3853,7 @@ void LLAppViewer::purgeCache()
|
|||
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->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), mask);
|
||||
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), "*.*");
|
||||
}
|
||||
|
||||
std::string LLAppViewer::getSecondLifeTitle() const
|
||||
|
|
|
|||
Loading…
Reference in New Issue