forked from GNOME/meld
-
Notifications
You must be signed in to change notification settings - Fork 120
/
Meld
executable file
·48 lines (40 loc) · 1.1 KB
/
Meld
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
import sys
import os
import subprocess
import locale
def getScriptPath():
return os.path.dirname(os.path.realpath(sys.argv[0]))
def fix_abspath(path):
if not os.path.isabs(path):
cwd = os.environ['PWD']
path = os.path.join(cwd, path)
return os.path.normpath(path)
arglist = []
for arg in sys.argv[1:]:
if arg.startswith('--output'):
filename = arg.split('=')[1]
newArg = '--output=' + fix_abspath(filename)
elif arg.startswith('-'):
newArg = arg
else:
newArg = fix_abspath(arg)
arglist.append(newArg)
MELDPATH = os.path.join(getScriptPath(), "Meld-bin")
APPPATH = fix_abspath(os.path.join(getScriptPath(), '..'))
LANG="C"
#try:
# LANG= ".".join(locale.getdefaultlocale()[0], "UTF-8")
#except:
# pass
environment = dict(os.environ, **{
"DYLD_LIBRARY_PATH": ":".join([
os.path.join(APPPATH, "Resources", "lib"),
os.path.join(APPPATH, "Frameworks")
]),
"LANG": LANG,
"LC_ALL": LANG,
"LC_CTYPE": LANG
})
status = subprocess.call([MELDPATH] + arglist, env=environment)
exit(status)