[GRASS-SVN] r67709 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 30 16:38:42 PST 2016


Author: wenzeslaus
Date: 2016-01-30 16:38:42 -0800 (Sat, 30 Jan 2016)
New Revision: 67709

Modified:
   grass/trunk/lib/init/grass.py
Log:
init: provide informative message for broken MS Win APPDATA settings

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2016-01-30 14:55:17 UTC (rev 67708)
+++ grass/trunk/lib/init/grass.py	2016-01-31 00:38:42 UTC (rev 67709)
@@ -95,6 +95,11 @@
 
 # Variables substituted during build process
 if 'GISBASE' in os.environ:
+    # TODO: should this be something like GRASS_PATH?
+    # GISBASE marks complete runtime, so no need to get it here when
+    # setting it up, possible scenario: existing runtime and starting
+    # GRASS in that, we want to overwrite the settings, not to take it
+    # possibly same for GRASS_PROJSHARE and others but maybe not
     gisbase = os.environ['GISBASE']
 else:
     gisbase = "@GISBASE@"
@@ -379,7 +384,15 @@
     """
     if sys.platform == 'win32':
         grass_config_dirname = "GRASS7"
-        directory = os.path.join(os.getenv('APPDATA'), grass_config_dirname)
+        win_conf_path = os.getenv('APPDATA')
+        # this can happen with some strange settings
+        if not win_conf_path:
+            fatal(_("The APPDATA variable is not set, ask your operating"
+                    " system support"))
+        if not os.path.exists(win_conf_path):
+            fatal(_("The APPDATA variable points to directory which does"
+                    " not exist, ask your operating system support"))
+        directory = os.path.join(win_conf_path, grass_config_dirname)
     else:
         grass_config_dirname = ".grass7"
         directory = os.path.join(os.getenv('HOME'), grass_config_dirname)



More information about the grass-commit mailing list