瀏覽代碼

check if gisrc is available when starting grass with `-text` switch

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45116 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 年之前
父節點
當前提交
f2947e4944
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      lib/init/grass.py

+ 9 - 3
lib/init/grass.py

@@ -195,7 +195,7 @@ def create_gisrc():
     # Set the session grassrc file
     gisrc = os.path.join(tmpdir, "gisrc")
     os.environ['GISRC'] = gisrc
-
+    
     # remove invalid GISRC file to avoid disturbing error messages:
     try:
 	s = readfile(gisrcrc)
@@ -930,12 +930,18 @@ set_browser()
 
 #predefine monitor size for certain architectures
 if os.getenv('HOSTTYPE') == 'arm':
-    #small monitor on ARM (iPAQ, zaurus... etc)
+    # small monitor on ARM (iPAQ, zaurus... etc)
     os.environ['GRASS_HEIGHT'] = "320"
-    os.environ['GRASS_WIDTH'] = "240"
+    os.environ['GRASS_WIDTH']  = "240"
 
 # First time user - GISRC is defined in the GRASS script
 if not os.access(gisrc, os.F_OK):
+    if grass_gui == 'text' and len(args) == 0:
+        fatal(_("Unable to start GRASS. You can:\n"
+                " - Launch GRASS with '-gui' switch (`grass70 -gui`)\n"
+                " - Create manually GISRC file (%s)\n"
+                " - Launch GRASS with path to "
+                "the location/mapset as an argument (`grass70 /path/to/location/mapset`)") % gisrcrc)
     grass_intro()
 else:
     clean_temp()