From 44f624f64fa4a3cef8e1010318a0b80c9d52b865 Mon Sep 17 00:00:00 2001 From: Nicolas Frattaroli Date: Sat, 9 Mar 2013 15:35:42 +0100 Subject: [PATCH] Fixed paths with square brackets in them. --- overviewer_core/world.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/overviewer_core/world.py b/overviewer_core/world.py index 8480a98..450c700 100644 --- a/overviewer_core/world.py +++ b/overviewer_core/world.py @@ -21,6 +21,7 @@ import logging import hashlib import time import random +import re import numpy @@ -492,14 +493,14 @@ class RegionSet(object): logging.debug("regiondir is %s", self.regiondir) - for path in glob(self.regiondir + "/r.*.*.mca"): - dirpath, f = os.path.split(path) - p = f.split(".") - x = int(p[1]) - y = int(p[2]) - if abs(x) > 500000 or abs(y) > 500000: - logging.warning("Holy shit what is up with region file %s !?" % f) - yield (x, y, path) + for f in os.listdir(self.regiondir): + if re.match(r"^r\.-?\d+\.-?\d+\.mca$", f): + p = f.split(".") + x = int(p[1]) + y = int(p[2]) + if abs(x) > 500000 or abs(y) > 500000: + logging.warning("Holy shit what is up with region file %s !?" % f) + yield (x, y, os.path.join(self.regiondir, f)) class RegionSetWrapper(object): """This is the base class for all "wrappers" of RegionSet objects. A