ソースを参照

wxGUI: additional checks from GetGRASSCmds()
(merge https://trac.osgeo.org/grass/changeset/49776 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49777 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 13 年 前
コミット
179051b796
1 ファイル変更11 行追加9 行削除
  1. 11 9
      gui/wxpython/core/globalvar.py

+ 11 - 9
gui/wxpython/core/globalvar.py

@@ -121,7 +121,7 @@ def GetGRASSCmds(scriptsOnly = False):
     cmd = list()
     cmd = list()
     
     
     # scan bin/
     # scan bin/
-    if not scriptsOnly:
+    if not scriptsOnly and os.path.exists(os.path.join(gisbase, 'bin')):
         for fname in os.listdir(os.path.join(gisbase, 'bin')):
         for fname in os.listdir(os.path.join(gisbase, 'bin')):
             name, ext = os.path.splitext(fname)
             name, ext = os.path.splitext(fname)
             if not EXT_BIN:
             if not EXT_BIN:
@@ -130,16 +130,18 @@ def GetGRASSCmds(scriptsOnly = False):
                 cmd.append(name)
                 cmd.append(name)
     
     
     # scan scripts/
     # scan scripts/
-    for fname in os.listdir(os.path.join(gisbase, 'scripts')):
-        name, ext = os.path.splitext(fname)
-        if not EXT_SCT:
-            cmd.append(fname)
-        elif ext == EXT_SCT:
-            cmd.append(name)
+    if os.path.exists(os.path.join(gisbase, 'scripts')):
+        for fname in os.listdir(os.path.join(gisbase, 'scripts')):
+            name, ext = os.path.splitext(fname)
+            if not EXT_SCT:
+                cmd.append(fname)
+            elif ext == EXT_SCT:
+                cmd.append(name)
     
     
     # scan gui/scripts/
     # scan gui/scripts/
-    os.environ["PATH"] = os.getenv("PATH") + os.pathsep + os.path.join(gisbase, 'etc', 'gui', 'scripts')
-    cmd = cmd + os.listdir(os.path.join(gisbase, 'etc', 'gui', 'scripts'))
+    if os.path.exists(os.path.join(gisbase, 'etc', 'gui', 'scripts')):
+        os.environ["PATH"] = os.getenv("PATH") + os.pathsep + os.path.join(gisbase, 'etc', 'gui', 'scripts')
+        cmd = cmd + os.listdir(os.path.join(gisbase, 'etc', 'gui', 'scripts'))
     
     
     # scan addons
     # scan addons
     if os.getenv('GRASS_ADDON_PATH'):
     if os.getenv('GRASS_ADDON_PATH'):