Help: prefer the webhelp format manual if present

This commit is contained in:
Jean-Francois Dockes 2016-01-07 16:42:44 +01:00
parent c7c69d9101
commit 53619920e2

View file

@ -431,17 +431,28 @@ void RclMain::startManual()
void RclMain::startManual(const string& index) void RclMain::startManual(const string& index)
{ {
Rcl::Doc doc; string docdir = path_cat(theconfig->getDatadir(), "doc");
string path = theconfig->getDatadir();
path = path_cat(path, "doc"); // The single page user manual is nicer if we have an index. Else
path = path_cat(path, "index.html"); // the webhelp one is nicer if it is present
string usermanual = path_cat(docdir, "usermanual.html");
string webhelp = path_cat(docdir, "webhelp");
webhelp = path_cat(webhelp, "index.html");
bool has_wh = path_exists(webhelp);
LOGDEB(("RclMain::startManual: help index is %s\n", LOGDEB(("RclMain::startManual: help index is %s\n",
index.empty()?"(null)":index.c_str())); index.empty()?"(null)":index.c_str()));
if (!index.empty()) { if (!index.empty()) {
path += "#"; usermanual += "#";
path += index; usermanual += index;
}
Rcl::Doc doc;
if (has_wh && index.empty()) {
doc.url = path_pathtofileurl(webhelp);
} else {
doc.url = path_pathtofileurl(usermanual);
} }
doc.url = path_pathtofileurl(path);
doc.mimetype = "text/html"; doc.mimetype = "text/html";
startNativeViewer(doc); startNativeViewer(doc);
} }