summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petithory <vincent.petithory@gmail.com>2013-03-27 20:49:16 +0100
committerVincent Petithory <vincent.petithory@gmail.com>2013-03-27 20:49:16 +0100
commita8d8283a8c2189ad87761b7b1b3d827199987fef (patch)
treebd91745d9e5030328f4b7ce04159abd671923e88
parent7f88c26e18c0d4b86e9b447f7b2207fd1ab5b2c0 (diff)
downloadclientdata-a8d8283a8c2189ad87761b7b1b3d827199987fef.tar.gz
clientdata-a8d8283a8c2189ad87761b7b1b3d827199987fef.tar.bz2
clientdata-a8d8283a8c2189ad87761b7b1b3d827199987fef.tar.xz
clientdata-a8d8283a8c2189ad87761b7b1b3d827199987fef.zip
Minimap renderer: allow to run elsewhere than tools/
-rwxr-xr-xtools/minimap-render.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/minimap-render.py b/tools/minimap-render.py
index 6b6b009f..33917eed 100755
--- a/tools/minimap-render.py
+++ b/tools/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: