1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <helpcompiler/HelpIndexer.hxx>
11 #include <osl/file.hxx>
12 #include <osl/process.h>
13 #include <osl/thread.h>
17 int main(int argc
, char **argv
)
21 const std::string
aLang("-lang");
22 const std::string
aModule("-mod");
23 const std::string
aDir("-dir");
30 for (int i
= 1; i
< argc
; ++i
) {
31 if (aLang
.compare(argv
[i
]) == 0) {
37 } else if (aModule
.compare(argv
[i
]) == 0) {
43 } else if (aDir
.compare(argv
[i
]) == 0) {
55 std::cerr
<< "Error parsing command-line arguments" << std::endl
;
58 if (error
|| lang
.empty() || module
.empty() || dir
.empty()) {
59 std::cerr
<< "Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -dir Dir" << std::endl
;
65 osl::File::getFileURLFromSystemPath(
66 OUString(dir
.c_str(), dir
.size(), osl_getThreadTextEncoding()),
70 osl_getProcessWorkingDir(&cwd
.pData
);
72 (void)osl::File::getAbsoluteFileURL(cwd
, sDir
, sDir
);
75 OUString(lang
.c_str(), lang
.size(), osl_getThreadTextEncoding()),
76 OUString(module
.c_str(), module
.size(), osl_getThreadTextEncoding()),
79 if (!indexer
.indexDocuments()) {
80 std::cerr
<< indexer
.getErrorMessage() << std::endl
;
85 catch (std::exception
& e
)
87 std::cerr
<< "failure: " << e
.what() << std::endl
;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */