summaryrefslogtreecommitdiff
path: root/client/minimap-render.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/minimap-render.py')
-rwxr-xr-xclient/minimap-render.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/client/minimap-render.py b/client/minimap-render.py
index 6b6b009..33917ee 100755
--- a/client/minimap-render.py
+++ b/client/minimap-render.py
@@ -7,6 +7,12 @@ import subprocess
import tempfile
import re
+CLIENT_DATA_ROOT = os.path.realpath(
+ os.path.join(
+ os.path.dirname(__file__),
+ u'..',
+ )
+)
class MinimapRenderer(object):
@@ -38,8 +44,8 @@ class MinimapRenderer(object):
self.map_name = self.map_name+u'.tmx'
map_number = os.path.splitext(os.path.basename(self.map_name))[0]
- tmx_file = os.path.normpath(os.path.join(os.getcwdu(), u'..', u'maps', self.map_name))
- minimap_file = os.path.normpath(os.path.join(os.getcwdu(), u'..', u'graphics', u'minimaps', map_number+u'.png'))
+ tmx_file = os.path.join(CLIENT_DATA_ROOT, u'maps', self.map_name)
+ minimap_file = os.path.join(CLIENT_DATA_ROOT, u'graphics', u'minimaps', map_number+u'.png')
prefix = os.path.commonprefix((tmx_file, minimap_file))
sys.stdout.write(u'%s -> %s\n' % (os.path.relpath(tmx_file, prefix), os.path.relpath(minimap_file, prefix)))
@@ -135,9 +141,6 @@ def main():
if not len(sys.argv) > 1:
usage()
return 127
- if not os.path.basename(os.path.dirname(os.getcwdu())) == u'client-data':
- sys.stderr.write(u'This script must be run from client-data/tools.\n')
- return 1
try:
MinimapRenderer.check_programs()
except Exception as e: