aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-08-03 08:37:56 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-08-05 08:45:15 +0200
commitdd9909a574514f59eb527db682a4e8d85350ead9 (patch)
tree6dcc2751f6a823922d6cde187f916794133eb3ef
parent59c58f230e68b528dd1f425f5211b681481c7cea (diff)
minetestmapper can be run from any directory
If it doesn't find colors.txt locally, it looks for the one in the directory of the script itself.
-rwxr-xr-xutil/minetestmapper.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/minetestmapper.py b/util/minetestmapper.py
index cf2a5776d..e13a1bdc3 100755
--- a/util/minetestmapper.py
+++ b/util/minetestmapper.py
@@ -152,7 +152,10 @@ if path[-1:] != "/" and path[-1:] != "\\":
# Load color information for the blocks.
colors = {}
-f = file("colors.txt")
+try:
+ f = file("colors.txt")
+except IOError:
+ f = file(os.path.join(os.path.dirname(__file__), "colors.txt"))
for line in f:
values = string.split(line)
colors[int(values[0], 16)] = (