diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-22 09:52:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-23 10:31:20 +0000 |
commit | d5c14a99dc9f0354b619181e7c2943c7e5ba121e (patch) | |
tree | a3a76ae0a734c0836b28d215306af7ff4abc4c2b /l10ntools | |
parent | tweak for cross-platformity (diff) | |
download | core-d5c14a99dc9f0354b619181e7c2943c7e5ba121e.tar.gz core-d5c14a99dc9f0354b619181e7c2943c7e5ba121e.zip |
just link to HelpIndexer
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/inc/l10ntools/HelpIndexer.hxx | 8 | ||||
-rw-r--r-- | l10ntools/source/help/HelpIndexer.cxx | 9 | ||||
-rw-r--r-- | l10ntools/source/help/HelpIndexer_main.cxx | 46 |
3 files changed, 23 insertions, 40 deletions
diff --git a/l10ntools/inc/l10ntools/HelpIndexer.hxx b/l10ntools/inc/l10ntools/HelpIndexer.hxx index ac034b5075f4..02281c210d1b 100644 --- a/l10ntools/inc/l10ntools/HelpIndexer.hxx +++ b/l10ntools/inc/l10ntools/HelpIndexer.hxx @@ -26,13 +26,11 @@ class L10N_DLLPUBLIC HelpIndexer { /** * @param lang Help files language. * @param module The module of the helpfiles. - * @param captionDir The directory to scan for caption files. - * @param contentDir The directory to scan for content files. - * @param indexDir The directory to write the index to. + * @param srcDir The help directory to index + * @param outDir The directory to write the "module".idxl directory to */ HelpIndexer(rtl::OUString const &lang, rtl::OUString const &module, - rtl::OUString const &captionDir, rtl::OUString const &contentDir, - rtl::OUString const &indexDir); + rtl::OUString const &srcDir, rtl::OUString const &outDir); /** * Run the indexer. diff --git a/l10ntools/source/help/HelpIndexer.cxx b/l10ntools/source/help/HelpIndexer.cxx index 9182005b100d..8b8db1493f40 100644 --- a/l10ntools/source/help/HelpIndexer.cxx +++ b/l10ntools/source/help/HelpIndexer.cxx @@ -42,10 +42,13 @@ using namespace lucene::document; HelpIndexer::HelpIndexer(rtl::OUString const &lang, rtl::OUString const &module, - rtl::OUString const &captionDir, rtl::OUString const &contentDir, rtl::OUString const &indexDir) : -d_lang(lang), d_module(module), d_captionDir(captionDir), d_contentDir(contentDir), d_indexDir(indexDir), -d_error(), d_files() + rtl::OUString const &srcDir, rtl::OUString const &outDir) + : d_lang(lang), d_module(module) { + d_indexDir = rtl::OUStringBuffer(outDir).append('/'). + append(module).appendAscii(RTL_CONSTASCII_STRINGPARAM(".idxl")).toString(); + d_captionDir = srcDir + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/caption")); + d_contentDir = srcDir + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/content")); } bool HelpIndexer::indexDocuments() { diff --git a/l10ntools/source/help/HelpIndexer_main.cxx b/l10ntools/source/help/HelpIndexer_main.cxx index 937f273b5c07..73b80aeb3ac5 100644 --- a/l10ntools/source/help/HelpIndexer_main.cxx +++ b/l10ntools/source/help/HelpIndexer_main.cxx @@ -37,13 +37,11 @@ int main(int argc, char **argv) { const std::string pLang("-lang"); const std::string pModule("-mod"); - const std::string pOutDir("-zipdir"); - const std::string pSrcDir("-srcdir"); + const std::string pDir("-dir"); std::string lang; std::string module; - std::string srcDir; - std::string outDir; + std::string dir; bool error = false; for (int i = 1; i < argc; ++i) { @@ -59,15 +57,9 @@ int main(int argc, char **argv) { } else { error = true; } - } else if (pOutDir.compare(argv[i]) == 0) { + } else if (pDir.compare(argv[i]) == 0) { if (i + 1 < argc) { - outDir = argv[++i]; - } else { - error = true; - } - } else if (pSrcDir.compare(argv[i]) == 0) { - if (i + 1 < argc) { - srcDir = argv[++i]; + dir = argv[++i]; } else { error = true; } @@ -80,40 +72,30 @@ int main(int argc, char **argv) { std::cerr << "Error parsing command-line arguments" << std::endl; } - if (error || lang.empty() || module.empty() || srcDir.empty() || outDir.empty()) { - std::cerr << "Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -srcdir SourceDir -zipdir OutputDir" << std::endl; + if (error || lang.empty() || module.empty() || dir.empty()) { + std::cerr << "Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -dir Dir" << std::endl; return 1; } - std::string captionDir(srcDir + SAL_PATHDELIMITER + "caption"); - std::string contentDir(srcDir + SAL_PATHDELIMITER + "content"); - std::string indexDir(outDir + SAL_PATHDELIMITER + module + ".idxl"); + std::string captionDir(dir + SAL_PATHDELIMITER + "caption"); + std::string contentDir(dir + SAL_PATHDELIMITER + "content"); + std::string indexDir(dir + SAL_PATHDELIMITER + module + ".idxl"); - rtl::OUString sCaptionDir, sContentDir, sIndexDir; - - osl::File::getFileURLFromSystemPath( - rtl::OUString(captionDir.c_str(), captionDir.size(), osl_getThreadTextEncoding()), - sCaptionDir); - - osl::File::getFileURLFromSystemPath( - rtl::OUString(contentDir.c_str(), contentDir.size(), osl_getThreadTextEncoding()), - sContentDir); + rtl::OUString sDir; osl::File::getFileURLFromSystemPath( - rtl::OUString(indexDir.c_str(), indexDir.size(), osl_getThreadTextEncoding()), - sIndexDir); + rtl::OUString(dir.c_str(), dir.size(), osl_getThreadTextEncoding()), + sDir); rtl::OUString cwd; osl_getProcessWorkingDir(&cwd.pData); - osl::File::getAbsoluteFileURL(cwd, sCaptionDir, sCaptionDir); - osl::File::getAbsoluteFileURL(cwd, sContentDir, sContentDir); - osl::File::getAbsoluteFileURL(cwd, sIndexDir, sIndexDir); + osl::File::getAbsoluteFileURL(cwd, sDir, sDir); HelpIndexer indexer( rtl::OUString(lang.c_str(), lang.size(), osl_getThreadTextEncoding()), rtl::OUString(module.c_str(), module.size(), osl_getThreadTextEncoding()), - sCaptionDir, sContentDir, sIndexDir); + sDir, sDir); if (!indexer.indexDocuments()) { std::wcerr << indexer.getErrorMessage().getStr() << std::endl; |