diff options
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 423124340..3d5b24b84 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -584,23 +584,15 @@ bool cmCacheManager::DeleteCache(const char* path) cmSystemTools::ConvertToUnixSlashes(cacheFile); std::string cmakeFiles = cacheFile; cacheFile += "/CMakeCache.txt"; - cmSystemTools::RemoveFile(cacheFile.c_str()); - // now remove the files in the CMakeFiles directory - // this cleans up language cache files - cmsys::Directory dir; - cmakeFiles += cmake::GetCMakeFilesDirectory(); - dir.Load(cmakeFiles.c_str()); - for (unsigned long fileNum = 0; - fileNum < dir.GetNumberOfFiles(); - ++fileNum) - { - if(!cmSystemTools:: - FileIsDirectory(dir.GetFile(fileNum))) + if(cmSystemTools::FileExists(cacheFile.c_str())) + { + cmSystemTools::RemoveFile(cacheFile.c_str()); + // now remove the files in the CMakeFiles directory + // this cleans up language cache files + cmakeFiles += cmake::GetCMakeFilesDirectory(); + if(cmSystemTools::FileIsDirectory(cmakeFiles.c_str())) { - std::string fullPath = cmakeFiles; - fullPath += "/"; - fullPath += dir.GetFile(fileNum); - cmSystemTools::RemoveFile(fullPath.c_str()); + cmSystemTools::RemoveADirectory(cmakeFiles.c_str()); } } return true; |