[sword-cvs] sword/src/mgr swmgr.cpp,1.94,1.95

sword@www.crosswire.org sword@www.crosswire.org
Fri, 29 Aug 2003 12:02:47 -0700


Update of /usr/local/cvsroot/sword/src/mgr
In directory www:/tmp/cvs-serv3169/src/mgr

Modified Files:
	swmgr.cpp 
Log Message:
Added lucene to rawtext driver so all Bibles can use lucene search.
Looking forward to having a better search PLUGIN mechanism soon.


Index: swmgr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/mgr/swmgr.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- swmgr.cpp	14 Aug 2003 00:57:38 -0000	1.94
+++ swmgr.cpp	29 Aug 2003 19:02:45 -0000	1.95
@@ -436,7 +436,7 @@
 	stdstr(&globPaths, globalConfPath);
 	for (gfp = strtok(globPaths, ":"); gfp; gfp = strtok(0, ":")) {
 
-	#ifndef _MSC_VER
+#ifndef _MSC_VER
 if (debug)
 	std::cerr << "\nChecking for " << gfp << "...";
 #endif
@@ -444,15 +444,33 @@
 		if (FileMgr::existsFile(gfp))
 			break;
 	}
+	SWBuf sysConfPath;
+	if (gfp)
+		sysConfPath = gfp;
+
+	SWBuf homeDir  = getenv ("HOME");
+	if (homeDir.size() > 0) {
+		if ((homeDir[homeDir.size()-1] != '\\') && (homeDir[homeDir.size()-1] != '/'))
+			homeDir += "/";
+		homeDir += ".sword/sword.conf";
+		if (FileMgr::existsFile(homeDir)) {
+#ifndef _MSC_VER
+if (debug)
+	std::cerr << "\nOverriding any systemwide sword.conf with one found in users home directory." << gfp << "...";
+#endif
+			sysConfPath = homeDir;
+		}
+	}
 
-	if (gfp) {
+
+	if (sysConfPath.size()) {
 
 #ifndef _MSC_VER
 if (debug)
 	std::cerr << "found\n";
 #endif
 
-		SWConfig etcconf(gfp);
+		SWConfig etcconf(sysConfPath);
 		if ((entry = etcconf.Sections["Install"].find("DataPath")) != etcconf.Sections["Install"].end()) {
 			path = (*entry).second;
 			if (((*entry).second.c_str()[strlen((*entry).second.c_str())-1] != '\\') && ((*entry).second.c_str()[strlen((*entry).second.c_str())-1] != '/'))
@@ -460,7 +478,7 @@
 
 #ifndef _MSC_VER
 if (debug)
-	std::cerr << "DataPath in " << gfp << " is set to: " << path;
+	std::cerr << "DataPath in " << sysConfPath << " is set to: " << path;
 #endif
 
 #ifndef _MSC_VER