- kernel_appli_dir = os.environ['KERNEL_ROOT_DIR']
- command = ""
- if os.path.exists("/usr/bin/gnome-terminal"):
- command = 'gnome-terminal -t "SALOME %s - Shell session" -e "%s/salome shell" &'%(version,kernel_appli_dir)
- elif os.path.exists("/usr/bin/konsole"):
- command = 'PATH="/usr/bin:/sbin:/bin" LD_LIBRARY_PATH="" konsole -e "%s/salome shell" &'%(kernel_appli_dir)
- elif os.path.exists("/usr/bin/xterm"):
- command = 'xterm -T "SALOME %s - Shell session" -e "%s/salome shell" &'%(version,kernel_appli_dir)
- else:
- print("Neither xterm nor gnome-terminal nor konsole is installed.")
-
- if command is not "":
+ runner = 'run_salome.exe' if platform.system() == 'Windows' else 'salome'
+
+ command = ''
+ for env_var in ('PRODUCT_ROOT_DIR', 'SALOME_ROOT_DIR', 'KERNEL_ROOT_DIR'):
+ script_dir = os.getenv(env_var)
+ if script_dir and os.path.isfile(os.path.join(script_dir, runner)):
+ command = os.path.join(script_dir, runner)
+ break
+
+ if command:
+ if platform.system() == 'Windows':
+ command = 'call "%s" shell' % command
+ else:
+ if os.path.exists("/usr/bin/xterm"):
+ command = 'xterm -T "SALOME %s - Shell session" -e "%s" shell &' % (version, command)
+ else:
+ QMessageBox.critical(SalomePyQt.getDesktop(), "Error", "xterm does not seem to be installed")
+ return
+