From 51934826e0444dac8cd031fbec522b27e307b3e5 Mon Sep 17 00:00:00 2001 From: Tobias Klein Date: Sun, 21 Jan 2024 09:36:48 +0100 Subject: [PATCH] ModuleStore::createSWMgr / Refactor creation of markupFilterMgr --- src/sword_backend/module_store.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sword_backend/module_store.cpp b/src/sword_backend/module_store.cpp index 7bf4301..9a557ed 100644 --- a/src/sword_backend/module_store.cpp +++ b/src/sword_backend/module_store.cpp @@ -66,10 +66,12 @@ SWMgr* ModuleStore::createSWMgr() isAndroid = true; #endif + MarkupFilterMgr* markupFilterMgr = new MarkupFilterMgr(sword::FMT_OSIS, sword::ENC_UTF8); + if (customHomeDir != "" || isAndroid) { swMgr = new SWMgr(this->_fileSystemHelper.getUserSwordDir().c_str(), true, // autoload - new MarkupFilterMgr(sword::FMT_OSIS, sword::ENC_UTF8), + markupFilterMgr, false, // multiMod false); // augmentHome @@ -82,7 +84,7 @@ SWMgr* ModuleStore::createSWMgr() #ifdef _WIN32 swMgr = new SWMgr(this->_fileSystemHelper.getUserSwordDir().c_str(), true, // autoload - new MarkupFilterMgr(sword::FMT_OSIS, sword::ENC_UTF8), + markupFilterMgr, false, // multimod true); // augmentHome @@ -90,13 +92,13 @@ SWMgr* ModuleStore::createSWMgr() // We're keeping it here for now in case this becomes relevant again. // this->_mgr->augmentModules(this->_fileSystemHelper.getSystemSwordDir().c_str()); #elif defined(__APPLE__) - swMgr = new SWMgr(new MarkupFilterMgr(sword::FMT_OSIS, sword::ENC_UTF8)); + swMgr = new SWMgr(markupFilterMgr); stringstream appSupport; appSupport << string(getenv("HOME")) << "/Library/Application Support/Sword"; swMgr->augmentModules(appSupport.str().c_str()); #else // LINUX! - swMgr = new SWMgr(new MarkupFilterMgr(sword::FMT_OSIS, sword::ENC_UTF8)); + swMgr = new SWMgr(markupFilterMgr); #endif }