1- #!/usr/bin/python
1+ #!/usr/bin/env python
22
33import sys
44import os
@@ -7,23 +7,33 @@ import subprocess
77def getScriptPath ():
88 return os .path .dirname (os .path .realpath (sys .argv [0 ]))
99
10+ def fix_abspath (path ):
11+ if not os .path .isabs (path ):
12+ cwd = os .environ ['PWD' ]
13+ path = os .path .join (cwd , path )
14+ return os .path .normpath (path )
1015
1116arglist = []
1217for arg in sys .argv [1 :]:
1318 if arg .startswith ('--output' ):
1419 filename = arg .split ('=' )[1 ]
15- newArg = '--output=' + os . path . abspath (filename )
20+ newArg = '--output=' + fix_abspath (filename )
1621 elif arg .startswith ('-' ):
1722 newArg = arg
1823 else :
19- newArg = os . path . abspath (arg )
24+ newArg = fix_abspath (arg )
2025 arglist .append (newArg )
2126
22- MELDPATH = getScriptPath () + "/ Meld-bin"
23- APPPATH = os . path . abspath (os .path .join (getScriptPath (), '..' ))
27+ MELDPATH = os . path . join ( getScriptPath (), " Meld-bin")
28+ APPPATH = fix_abspath (os .path .join (getScriptPath (), '..' ))
2429
25- environment = dict (os .environ ,
26- ** { "DYLD_LIBRARY_PATH" : APPPATH + "/Resources/lib:" + APPPATH + "/Frameworks" ,
27- "LANG" : "C" })
30+ environment = dict (os .environ , ** {
31+ "DYLD_LIBRARY_PATH" : ":" .join ([
32+ os .path .join (APPPATH , "Resources" , "lib" ),
33+ os .path .join (APPPATH , "Frameworks" )
34+ ]),
35+ "LANG" : "C"
36+ })
2837
29- p = subprocess .call ([MELDPATH ] + arglist , env = environment )
38+ status = subprocess .call ([MELDPATH ] + arglist , env = environment )
39+ exit (status )
0 commit comments