[bt-devel] CSwordBackend::deleteOrphanedIndices()
Olaf Radicke
briefkasten at olaf-radicke.de
Thu Aug 5 14:39:37 MST 2010
Hi Martin!
Am Donnerstag, den 05.08.2010, 12:40 +0200 schrieb Martin Gruner:
> Hi Olaf,
>
> I don't see a problem in the original function deleteOrphanedIndices.
>
> It first goes to the directory
> CSwordModuleInfo::getGlobalBaseIndexLocation(), which is where all
> module index directories are supposed to be.
Really? Is it at all times the same? You get all times the same? You ar
absolute sure?
Okay, lat look the Code:
CSwordModuleInfo::getGlobalBaseIndexLocation()
It's call
util::directory::getUserIndexDir().absolutePath()
getUserIndexDir() get back cachedUserIndexDir
but who is set this?
It's set by function initDirectoryCache() line 210:
cachedUserIndexDir = cachedUserBaseDir;
Okay, but who is set cachedUserBaseDir?
In the same function line 170 you can find this:
cachedUserBaseDir = cachedUserHomeDir;
Okay, but who is set cachedUserHomeDir?
too lines befor:
cachedUserHomeDir = QDir(getenv("HOME"));
Okay , but who is set "HOME" and what is inside?!?
It's a system environment - correct?
who is initDirectoryCache()? It's in main(). I call in my code
getGlobalBaseIndexLocation() before initDirectoryCache()
is coming. I forget/ignorant this constrained. ...bad luck.
It's spaghetti code. doubtful.
> Your patch loops through all module subdirectories, and checks if one
> bibletime-index.conf is present, and then calls the original method. I
> don't see an added value there, because you are trying to work around a
> problem in the code with more code. Instead we should identify the real
> problem and fix it (if any).
Yes. that's a proxy-function. The origen interface is not touched. yet
is using of other code-part. If is use only the new interface, we can
remove this.
> If something strange was deleted on your system, we'd have to check
> CSwordModuleInfo::getGlobalBaseIndexLocation() instead (what if that
> directory doesn't yet exist?). Maybe you can try to reproduce exactly
> what went wrong here, so that we can add some checks.
You can Checkout my Git-Repos (http://www.fkbk.de/git/bibletime_bare/)
And remove '//' in line 146 in src/alter/infrastructure.cpp
and start the program (after backup!!)...
CU
Olaf
More information about the bt-devel
mailing list