소스 검색

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()
     
     # 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')):
             name, ext = os.path.splitext(fname)
             if not EXT_BIN:
@@ -130,16 +130,18 @@ def GetGRASSCmds(scriptsOnly = False):
                 cmd.append(name)
     
     # 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/
-    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
     if os.getenv('GRASS_ADDON_PATH'):