浏览代码

grass.py: improve check_shell() for Windows

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56175 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 年之前
父节点
当前提交
1863aeb492
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      lib/init/grass.py

+ 6 - 3
lib/init/grass.py

@@ -769,6 +769,9 @@ def check_shell():
         os.environ['OSTYPE'] = "cygwin"
     else:
         sh = os.path.basename(os.getenv('SHELL'))
+        if windows and sh:
+            sh = os.path.splitext(sh)[0]
+        
         if sh == "ksh":
             shellname = "Korn Shell"
         elif sh == "csh":
@@ -781,18 +784,18 @@ def check_shell():
             shellname = "Bourne Shell"
         elif sh == "zsh":
             shellname = "Z Shell"
-        elif sh == "cmd.exe":
+        elif sh == "cmd":
             shellname = "Command Shell"
         else:
             shellname = "shell"
     
     if sh in ['csh', 'tcsh']:
         grass_env_file = os.path.join(grass_config_dir, 'cshrc')
-    elif sh in ['bash', 'msh', 'cygwin']:
+    elif sh in ['bash', 'msh', 'cygwin', 'sh']:
         grass_env_file = os.path.join(grass_config_dir, 'bashrc')
     elif sh == 'zsh':
         grass_env_file = os.path.join(grass_config_dir, 'zshrc')
-    elif sh == 'cmd.exe':
+    elif sh == 'cmd':
         grass_env_file = os.path.join(grass_config_dir, 'env.bat')
     else:
         grass_env_file = os.path.join(grass_config_dir, 'bashrc')