Browse Source

wxGUI: don't fail when addon paths do not exist

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49909 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 years ago
parent
commit
23f6b0c103
1 changed files with 4 additions and 0 deletions
  1. 4 0
      gui/wxpython/core/globalvar.py

+ 4 - 0
gui/wxpython/core/globalvar.py

@@ -146,6 +146,8 @@ def GetGRASSCmds(scriptsOnly = False):
     # scan addons (base)
     # scan addons (base)
     if os.getenv('GRASS_ADDON_BASE'):
     if os.getenv('GRASS_ADDON_BASE'):
         for path in os.getenv('GRASS_ADDON_BASE').split(os.pathsep):
         for path in os.getenv('GRASS_ADDON_BASE').split(os.pathsep):
+            if not os.path.exists(path) or not os.path.isdir(path):
+                continue
             bpath = os.path.join(path, 'bin')
             bpath = os.path.join(path, 'bin')
             if not scriptsOnly and os.path.exists(bpath) and \
             if not scriptsOnly and os.path.exists(bpath) and \
                     os.path.isdir(bpath):
                     os.path.isdir(bpath):
@@ -168,6 +170,8 @@ def GetGRASSCmds(scriptsOnly = False):
     # scan addons (path)
     # scan addons (path)
     if os.getenv('GRASS_ADDON_PATH'):
     if os.getenv('GRASS_ADDON_PATH'):
         for path in os.getenv('GRASS_ADDON_PATH').split(os.pathsep):
         for path in os.getenv('GRASS_ADDON_PATH').split(os.pathsep):
+            if not os.path.exists(path) or not os.path.isdir(path):
+                continue
             for fname in os.listdir(path):
             for fname in os.listdir(path):
                 name, ext = os.path.splitext(fname)
                 name, ext = os.path.splitext(fname)
                 if ext in [EXT_BIN, EXT_SCT]:
                 if ext in [EXT_BIN, EXT_SCT]: