From 4b622b1333bfd4f8a7425e3522f785cce91e3fde Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sun, 11 Dec 2011 11:27:07 -0500 Subject: [PATCH] issue #559: don't error if the map needs expanding but the tiledir was deleted Also changed from using a join on self.destdir and self.tiledir to just using self.full_tiledir, which is the same thing but already computed. --- overviewer_core/quadtree.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/overviewer_core/quadtree.py b/overviewer_core/quadtree.py index f01f530..17209aa 100644 --- a/overviewer_core/quadtree.py +++ b/overviewer_core/quadtree.py @@ -135,7 +135,7 @@ class QuadtreeGen(object): def _increase_depth(self): """Moves existing tiles into place for a larger tree""" - getpath = functools.partial(os.path.join, self.destdir, self.tiledir) + getpath = functools.partial(os.path.join, self.full_tiledir) # At top level of the tree: # quadrant 0 is now 0/3 @@ -162,7 +162,7 @@ class QuadtreeGen(object): def _decrease_depth(self): """If the map size decreases, or perhaps the user has a depth override in effect, re-arrange existing tiles for a smaller tree""" - getpath = functools.partial(os.path.join, self.destdir, self.tiledir) + getpath = functools.partial(os.path.join, self.full_tiledir) # quadrant 0/3 goes to 0 # 1/2 goes to 1 @@ -204,6 +204,12 @@ class QuadtreeGen(object): """ + # If the tile directory has been deleted somehow, then don't bother + # trying to rearrange things. It wouldn't do any good and would error + # out anyways. + if not os.path.exists(self.full_tiledir): + return + curdepth = self._get_cur_depth() if curdepth != -1: if self.p > curdepth: