[sword-svn] r3887 - trunk/src/mgr

scribe at crosswire.org scribe at crosswire.org
Thu Nov 3 19:32:24 EDT 2022


Author: scribe
Date: 2022-11-03 19:32:24 -0400 (Thu, 03 Nov 2022)
New Revision: 3887

Modified:
   trunk/src/mgr/swmgr.cpp
Log:
simplified and actually made skipCache work


Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp	2022-11-03 23:18:54 UTC (rev 3886)
+++ trunk/src/mgr/swmgr.cpp	2022-11-03 23:32:24 UTC (rev 3887)
@@ -752,39 +752,35 @@
 	SWBuf newModFile;
 	newModFile = basePath + "modules-conf.cache";
 	skipCache = skipCache || !FileMgr::existsFile(newModFile.c_str());
-	SWConfig *pathConfig = new SWConfig(newModFile);
 
-	if (!skipCache) {
-		if (config) {
-			config->augment(*pathConfig);
-			delete pathConfig;
-		}
-		else	config = myconfig = pathConfig;
-		return;
+	if (skipCache) {
+		// assure any cache file is removed
+		FileMgr::removeFile(newModFile.c_str());
 	}
 
-	if (!config) config = myconfig = pathConfig;
+	SWConfig *pathConfig = new SWConfig(newModFile);
 
-	std::vector<DirEntry> dirList = FileMgr::getDirList(ipath);
-	for (unsigned int i = 0; i < dirList.size(); ++i) {
-		//check whether it ends with .conf, if it doesn't skip it!
-		if (!dirList[i].name.endsWith(".conf")) {
-			continue;
+	if (skipCache) {
+		std::vector<DirEntry> dirList = FileMgr::getDirList(ipath);
+		for (unsigned int i = 0; i < dirList.size(); ++i) {
+			//check whether it ends with .conf, if it doesn't skip it!
+			if (!dirList[i].name.endsWith(".conf")) {
+				continue;
+			}
+
+			newModFile = basePath + dirList[i].name;
+			SWConfig tmpConfig(newModFile);
+			pathConfig->augment(tmpConfig);
 		}
 
-		newModFile = basePath + dirList[i].name;
-		SWConfig tmpConfig(newModFile);
-		config->augment(tmpConfig);
+		pathConfig->save();
 	}
 
-	pathConfig->save();
-
-	// if we're not handing off our pathConfig to be managed by our object
-	// we need to clean up
-	if (pathConfig != myconfig) {
+	if (config) {
+		config->augment(*pathConfig);
 		delete pathConfig;
 	}
-
+	else	config = myconfig = pathConfig;
 }
 
 



More information about the sword-cvs mailing list