##// END OF EJS Templates
util: move definition of datapath to resourceutil...
Martin von Zweigbergk -
r44068:9fb85668 default
parent child Browse files
Show More
@@ -1823,13 +1823,7 b' def pathto(root, n1, n2):'
1823 return pycompat.ossep.join(([b'..'] * len(a)) + b) or b'.'
1823 return pycompat.ossep.join(([b'..'] * len(a)) + b) or b'.'
1824
1824
1825
1825
1826 # the location of data files matching the source code
1826 datapath = resourceutil.datapath
1827 if resourceutil.mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app':
1828 # executable version (py2exe) doesn't support __file__
1829 datapath = os.path.dirname(pycompat.sysexecutable)
1830 else:
1831 datapath = os.path.dirname(pycompat.fsencode(__file__))
1832
1833 i18n.setdatapath(datapath)
1827 i18n.setdatapath(datapath)
1834
1828
1835
1829
@@ -10,6 +10,7 b''
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12 import imp
12 import imp
13 import os
13 import sys
14 import sys
14
15
15 from .. import pycompat
16 from .. import pycompat
@@ -26,3 +27,11 b' def mainfrozen():'
26 or pycompat.safehasattr(sys, "importers") # new py2exe
27 or pycompat.safehasattr(sys, "importers") # new py2exe
27 or imp.is_frozen("__main__") # old py2exe
28 or imp.is_frozen("__main__") # old py2exe
28 ) # tools/freeze
29 ) # tools/freeze
30
31
32 # the location of data files matching the source code
33 if mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app':
34 # executable version (py2exe) doesn't support __file__
35 datapath = os.path.dirname(pycompat.sysexecutable)
36 else:
37 datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__)))
General Comments 0
You need to be logged in to leave comments. Login now