From 856f0f46857218db34ecddde00b52a82340faaf6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 3 May 2010 09:23:07 +0200 Subject: [PATCH] ENH: use FOAM_DOC_BROWSER to specify alternative html document browser - change from 'kde-open %f' to the desktop-agnostic 'firefox %f' as the default document browser. --- etc/controlDict | 2 +- src/OpenFOAM/global/argList/argList.C | 7 ++++++- src/OpenFOAM/global/argList/argList.H | 12 ++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/etc/controlDict b/etc/controlDict index e1af08c7ae..891e010e0c 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -18,7 +18,7 @@ FoamFile Documentation { - docBrowser "kde-open %f"; + docBrowser "firefox %f"; doxyDocDirs ( "$WM_PROJECT_USER_DIR/html" diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 287dc9efcc..82c6ff47c9 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -881,7 +881,12 @@ void Foam::argList::displayDoc(bool source) const if (found) { - string docBrowser(docDict.lookup("docBrowser")); + string docBrowser = getEnv("FOAM_DOC_BROWSER"); + if (docBrowser.empty()) + { + docDict.lookup("docBrowser") >> docBrowser; + } + // can use FOAM_DOC_BROWSER='application file://%f' if required docBrowser.replaceAll("%f", docFile); Info<< "Show documentation: " << docBrowser.c_str() << endl; diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index c36955d5ce..85b2e26b57 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -37,7 +37,7 @@ Description @verbatim ( "file1.txt" "file2.txt" ... "fileN.txt" ) @endverbatim - The backslash-escaping has been used to avoid shell expansions. + The backslash-escaping is required to avoid interpretation by the shell. @par Default command-line options @param -case \ \n @@ -57,10 +57,14 @@ Description global case. Note - - Adjustment of the valid (mandatory) arguments + - The document browser used is defined by the @b FOAM_DOC_BROWSER + environment variable or the Documentation/docBrowser entry + in the ~OpenFOAM/controlDict file. + The \%f token is used as a placeholder for the file name. + - The valid (mandatory) arguments can be adjusted by directly manipulating the argList::validArgs static member. - - Adjustment of the valid options - via the addOption/removeOption static methods or by directly + - The valid options can be adjusted + via the addOption/removeOption static methods instead of directly manipulating the argList::validOptions static member. SourceFiles