Browse Source

g.manual: don't fail when browser is not available

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@41765 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 years ago
parent
commit
f4fa762a41
1 changed files with 7 additions and 3 deletions
  1. 7 3
      scripts/g.manual/g.manual.py

+ 7 - 3
scripts/g.manual/g.manual.py

@@ -6,7 +6,7 @@
 # AUTHOR(S):	Markus Neteler
 #               Converted to Python by Glynn Clements
 # PURPOSE:	Display the HTML/MAN pages
-# COPYRIGHT:	(C) 2003,2008 by the GRASS Development Team
+# COPYRIGHT:	(C) 2003,2008,2010 by the GRASS Development Team
 #
 #		This program is free software under the GNU General Public
 #		License (>=v2). Read the file COPYING that comes with GRASS
@@ -15,7 +15,7 @@
 #############################################################################
 
 #%Module
-#%  description: Display the HTML man pages of GRASS
+#%  description: Display the HTML man pages of GRASS GIS
 #%  keywords: general
 #%  keywords: manual
 #%  keywords: help
@@ -40,12 +40,16 @@ import os
 from grass.script import core as grass
 
 def start_browser(entry):
+    if not grass.find_program(browser):
+        grass.fatal(_("Browser <%s> not found") % browser)
+    
     path = os.path.join(gisbase, 'docs', 'html', entry + '.html')
     if not os.path.exists(path):
 	grass.fatal(_("No HTML manual page entry for <%s>.") % entry)
     verbose = os.getenv("GRASS_VERBOSE")
     if not verbose or int(verbose) > 1:
 	grass.message(_("Starting browser <%s> for module %s...") % (browser_name, entry))
+    
     os.execlp(browser, browser_name, "file://%s/docs/html/%s.html" % (gisbase, entry))
     grass.fatal(_("Error starting browser <%s> for HTML file <%s>") % (browser, entry))
 
@@ -65,7 +69,7 @@ def main():
     entry = options['entry']
 
     gisbase = os.environ['GISBASE']
-
+    
     browser = os.getenv('GRASS_HTML_BROWSER')
 
     if "html_browser_mac.sh" in browser: