Changeset 155:08f1f0a4dd9a for src/mlx/mlx.py
- Timestamp:
- 05/05/12 12:16:30 (12 years ago)
- Branch:
- default
- hg-Phase:
- (<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/mlx.py
r133 r155 7 7 import os 8 8 import sys 9 10 if os.name=="nt":11 import win32api12 9 13 10 #-------------------------------------------------------------------------------------- … … 25 22 #-------------------------------------------------------------------------------------- 26 23 24 def restart(args = []): 25 """Restart the program with the given arguments.""" 26 print "Restarting with args", args 27 programPath = os.path.join(os.path.dirname(sys.argv[0]), 28 "runmlx.exe" if os.name=="nt" else "runmlx.sh") 29 if os.name=="nt": 30 import win32api 31 try: 32 programPath = win32api.GetShortPathName(programPath) 33 except: 34 programPath = os.path.join(os.path.dirname(sys.argv[0]), 35 "runmlx.bat") 36 programPath = win32api.GetShortPathName(programPath) 37 38 args = [programPath] + args 39 40 os.execv(programPath, args) 41 42 #-------------------------------------------------------------------------------------- 43 27 44 def main(): 28 45 """The main operation of the program.""" … … 31 48 config = Config() 32 49 config.load() 50 51 if (len(sys.argv)<=1 or sys.argv[1]!="usedeflang") and config.setupLocale(): 52 restart(["usedeflang"]) 33 53 34 54 setLanguage(config.getLanguage()) … … 54 74 55 75 if gui.toRestart: 56 programPath = os.path.join(os.path.dirname(sys.argv[0]), 57 "runmlx.exe" if os.name=="nt" else "runmlx.sh") 58 if os.name=="nt": 59 programPath = win32api.GetShortPathName(programPath) 60 61 os.execl(programPath, programPath) 76 restart() 62 77 63 78 #--------------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.