diff options
author | Vincent Petithory <vincent.petithory@gmail.com> | 2013-03-27 20:49:16 +0100 |
---|---|---|
committer | Vincent Petithory <vincent.petithory@gmail.com> | 2013-03-27 20:49:16 +0100 |
commit | 795fe02f1080ff254d279ae28187df8fb1beb78e (patch) | |
tree | 5d3ff84941fe7c97608a4ced80982021395ea082 /client | |
parent | 2daee52eec6ace68bf49779acba61056aeba11be (diff) | |
download | tools-795fe02f1080ff254d279ae28187df8fb1beb78e.tar.gz tools-795fe02f1080ff254d279ae28187df8fb1beb78e.tar.bz2 tools-795fe02f1080ff254d279ae28187df8fb1beb78e.tar.xz tools-795fe02f1080ff254d279ae28187df8fb1beb78e.zip |
Minimap renderer: allow to run elsewhere than tools/
Diffstat (limited to 'client')
-rwxr-xr-x | client/minimap-render.py | 13 |
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: |