fixed -d flag, which now deletes just overviewer.dat
This commit is contained in:
17
gmap.py
17
gmap.py
@@ -90,13 +90,13 @@ def main():
|
|||||||
|
|
||||||
if len(args) != 2:
|
if len(args) != 2:
|
||||||
if options.delete:
|
if options.delete:
|
||||||
return delete_all(cachedir, None)
|
return delete_all(worlddir, None)
|
||||||
parser.error("Where do you want to save the tiles?")
|
parser.error("Where do you want to save the tiles?")
|
||||||
|
|
||||||
destdir = args[1]
|
destdir = args[1]
|
||||||
|
|
||||||
if options.delete:
|
if options.delete:
|
||||||
return delete_all(destdir)
|
return delete_all(worlddir, destdir)
|
||||||
|
|
||||||
if options.chunklist:
|
if options.chunklist:
|
||||||
chunklist = open(options.chunklist, 'r')
|
chunklist = open(options.chunklist, 'r')
|
||||||
@@ -142,16 +142,9 @@ def main():
|
|||||||
q.write_html(options.skipjs)
|
q.write_html(options.skipjs)
|
||||||
q.go(options.procs)
|
q.go(options.procs)
|
||||||
|
|
||||||
def delete_all(tiledir):
|
def delete_all(worlddir, tiledir):
|
||||||
# Delete all /hash/ files in the tile dir.
|
# TODO should we delete tiledir here too?
|
||||||
if tiledir:
|
|
||||||
for dirpath, dirnames, filenames in os.walk(tiledir):
|
|
||||||
for f in filenames:
|
|
||||||
if f.endswith(".hash"):
|
|
||||||
filepath = os.path.join(dirpath, f)
|
|
||||||
logging.info("Deleting {0}".format(filepath))
|
|
||||||
os.unlink(filepath)
|
|
||||||
|
|
||||||
# delete the overviewer.dat persistant data file
|
# delete the overviewer.dat persistant data file
|
||||||
datfile = os.path.join(worlddir,"overviewer.dat")
|
datfile = os.path.join(worlddir,"overviewer.dat")
|
||||||
if os.path.exists(datfile):
|
if os.path.exists(datfile):
|
||||||
|
|||||||
Reference in New Issue
Block a user