[sword-svn] r1799 - in trunk: . include src/mgr
scribe at crosswire.org
scribe at crosswire.org
Thu May 5 22:27:14 MST 2005
Author: scribe
Date: 2005-05-05 22:27:12 -0700 (Thu, 05 May 2005)
New Revision: 1799
Modified:
trunk/include/swmgr.h
trunk/src/mgr/filemgr.cpp
trunk/src/mgr/installmgr.cpp
trunk/src/mgr/swmgr.cpp
trunk/usrinst.sh
Log:
Added an option to turn off ~home private module augmenting
Made InstallMgr Sources not augment
Fixed FileMgr::getLine to not strip chunks, but rather the entire line
Modified: trunk/include/swmgr.h
===================================================================
--- trunk/include/swmgr.h 2005-05-05 12:59:56 UTC (rev 1798)
+++ trunk/include/swmgr.h 2005-05-06 05:27:12 UTC (rev 1799)
@@ -72,6 +72,7 @@
private:
bool mgrModeMultiMod;
+ bool augmentHome;
void commonInit(SWConfig * iconfig, SWConfig * isysconfig, bool autoload, SWFilterMgr *filterMgr, bool multiMod = false);
protected:
@@ -194,22 +195,28 @@
* @param filterMgr an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr
*/
SWMgr(SWConfig * iconfig = 0, SWConfig * isysconfig = 0, bool autoload = true, SWFilterMgr *filterMgr = 0, bool multiMod = false);
+
/**
*
* @param filterMgr an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr
*/
SWMgr(SWFilterMgr *filterMgr, bool multiMod = false);
+
/**
*
* @param iConfigPath Path to config files.
* @param autoload If this bool is true the constructor starts loading the
* installed modules. If you reimplemented SWMgr you can set autoload=false
* to load the modules with your own reimplemented function.
+ * @param iConfigPath explicit path to use where modules exist
* @param filterMgr an SWFilterMgr subclass to use to manager filters on
- * modules THIS WILL BE DELETED BY SWMgr
+ * modules THIS WILL BE DELETED BY SWMgr
+ * @param augmentHome whether or not to augment ~/.sword personal modules
+ * default is to augment modules,
*
*/
- SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0, bool multiMod = false);
+ SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0, bool multiMod = false, bool augmentHome = true);
+
/** The destructor of SWMgr.
* This function cleans up the modules and deletes the created object.
* Destroy the SWMgr at last object in your application, because otherwise you may experience crashes
Modified: trunk/src/mgr/filemgr.cpp
===================================================================
--- trunk/src/mgr/filemgr.cpp 2005-05-05 12:59:56 UTC (rev 1798)
+++ trunk/src/mgr/filemgr.cpp 2005-05-06 05:27:12 UTC (rev 1799)
@@ -430,11 +430,14 @@
len = fDesc->read(chunk, 254);
if (len < 1)
break;
- // clean up any preceding white space
- int start;
- for (start = 0; start < len; start++) {
- if ((chunk[start] != 13) && (chunk[start] != ' ') && (chunk[start] != '\t'))
- break;
+
+ int start = 0;
+ // clean up any preceding white space if we're at the beginning of line
+ if (!line.length()) {
+ for (;start < len; start++) {
+ if ((chunk[start] != 13) && (chunk[start] != ' ') && (chunk[start] != '\t'))
+ break;
+ }
}
// assert we have a readable file (not a directory)
@@ -451,12 +454,14 @@
// reposition to next valid place to read
fDesc->seek(index, SEEK_SET);
- // clean up any trailing junk on line
- for (; end > start; end--) {
- if ((chunk[end] != 10) && (chunk[end] != 13) && (chunk[end] != ' ') && (chunk[end] != '\t')) {
- if (chunk[end] == '\\')
- more = true;
- else break;
+ // clean up any trailing junk on line if we're at the end
+ if (!more) {
+ for (; end > start; end--) {
+ if ((chunk[end] != 10) && (chunk[end] != 13) && (chunk[end] != ' ') && (chunk[end] != '\t')) {
+ if (chunk[end] == '\\')
+ more = true;
+ else break;
+ }
}
}
Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp 2005-05-05 12:59:56 UTC (rev 1798)
+++ trunk/src/mgr/installmgr.cpp 2005-05-06 05:27:12 UTC (rev 1799)
@@ -198,7 +198,8 @@
SWMgr *InstallSource::getMgr() {
if (!mgr)
- mgr = new SWMgr(localShadow.c_str());
+ // ..., false = don't augment ~home directory.
+ mgr = new SWMgr(localShadow.c_str(), true, 0, false, false);
return mgr;
}
Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp 2005-05-05 12:59:56 UTC (rev 1798)
+++ trunk/src/mgr/swmgr.cpp 2005-05-06 05:27:12 UTC (rev 1799)
@@ -113,9 +113,9 @@
configType = 0;
myconfig = 0;
mysysconfig = 0;
- homeConfig = 0;
+ homeConfig = 0;
+ augmentHome = true;
-
cipherFilters.clear();
optionFilters.clear();
cleanupFilters.clear();
@@ -232,12 +232,13 @@
void SWMgr::commonInit(SWConfig * iconfig, SWConfig * isysconfig, bool autoload, SWFilterMgr *filterMgr, bool multiMod) {
+
+ init();
+
mgrModeMultiMod = multiMod;
this->filterMgr = filterMgr;
if (filterMgr)
filterMgr->setParentMgr(this);
-
- init();
if (iconfig) {
config = iconfig;
@@ -265,17 +266,19 @@
}
-SWMgr::SWMgr(const char *iConfigPath, bool autoload, SWFilterMgr *filterMgr, bool multiMod) {
+SWMgr::SWMgr(const char *iConfigPath, bool autoload, SWFilterMgr *filterMgr, bool multiMod, bool augmentHome) {
+ init();
+
mgrModeMultiMod = multiMod;
SWBuf path;
this->filterMgr = filterMgr;
if (filterMgr)
filterMgr->setParentMgr(this);
+
+ this->augmentHome = augmentHome;
- init();
-
path = iConfigPath;
int len = path.length();
if ((len < 1) || (iConfigPath[len-1] != '\\') && (iConfigPath[len-1] != '/'))
@@ -495,9 +498,9 @@
void SWMgr::loadConfigDir(const char *ipath)
{
- DIR *dir;
- struct dirent *ent;
- SWBuf newmodfile;
+ DIR *dir;
+ struct dirent *ent;
+ SWBuf newmodfile;
if ((dir = opendir(ipath))) {
rewinddir(dir);
@@ -604,14 +607,16 @@
for (std::list<SWBuf>::iterator pathIt = augPaths.begin(); pathIt != augPaths.end(); pathIt++) {
augmentModules(pathIt->c_str(), mgrModeMultiMod);
}
-// augment config with ~/.sword/mods.d if it exists ---------------------
- char *envhomedir = getenv ("HOME");
- if (envhomedir != NULL && configType != 2) { // 2 = user only
- SWBuf path = envhomedir;
- if ((envhomedir[strlen(envhomedir)-1] != '\\') && (envhomedir[strlen(envhomedir)-1] != '/'))
- path += "/";
- path += ".sword/";
- augmentModules(path.c_str(), mgrModeMultiMod);
+ if (augmentHome) {
+ // augment config with ~/.sword/mods.d if it exists ---------------------
+ char *envhomedir = getenv ("HOME");
+ if (envhomedir != NULL && configType != 2) { // 2 = user only
+ SWBuf path = envhomedir;
+ if ((envhomedir[strlen(envhomedir)-1] != '\\') && (envhomedir[strlen(envhomedir)-1] != '/'))
+ path += "/";
+ path += ".sword/";
+ augmentModules(path.c_str(), mgrModeMultiMod);
+ }
}
// -------------------------------------------------------------------------
if ( !Modules.size() ) // config exists, but no modules
Modified: trunk/usrinst.sh
===================================================================
--- trunk/usrinst.sh 2005-05-05 12:59:56 UTC (rev 1798)
+++ trunk/usrinst.sh 2005-05-06 05:27:12 UTC (rev 1799)
@@ -1,12 +1,12 @@
#!/bin/sh
OPTIONS="--prefix=/usr $OPTIONS"
-#OPTIONS="--disable-shared $OPTIONS"
+OPTIONS="--disable-shared $OPTIONS"
OPTIONS="--without-conf $OPTIONS"
OPTIONS="--sysconfdir=/etc $OPTIONS"
#OPTIONS="--with-icu $OPTIONS"
#OPTIONS="--with-vcl $OPTIONS"
-#OPTIONS="--enable-debug $OPTIONS"
+OPTIONS="--enable-debug $OPTIONS"
#OPTIONS="--enable-profile $OPTIONS"
#OPTIONS="--with-lucene $OPTIONS"
#OPTIONS="--without-curl $OPTIONS"
More information about the sword-cvs
mailing list