From 795fe02f1080ff254d279ae28187df8fb1beb78e Mon Sep 17 00:00:00 2001 From: Vincent Petithory Date: Wed, 27 Mar 2013 20:49:16 +0100 Subject: Minimap renderer: allow to run elsewhere than tools/ --- client/minimap-render.py | 13 ++++++++----- 1 file 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: -- cgit v1.2.3-60-g2f50