0

observer: create outputdir if it doesn't exist

Observers get initialised at config parse time, before Overviewer
creates the outputdir. So we can just tell them to create the
outputdir if it doesn't already exist to avoid an awkward error
on the initial render.

Fixes #1657.
This commit is contained in:
Nicolas F
2019-10-27 20:19:07 +01:00
parent a688c7b7c9
commit 3d31347e9b

View File

@@ -256,11 +256,10 @@ class JSObserver(Observer):
raise Exception("JSObserver: messages parameter must be a "
"dictionary with three entries: totalTiles, "
"renderCompleted and renderProgress")
# On the initial render, the outputdir hasn't been created until after the observer is
# initialised, so let's just do it here if necessary.
if not os.path.exists(outputdir):
raise Exception("JSObserver: Output directory specified (%s) "
"doesn't appear to exist. This should be the "
"same as the Overviewer output directory"
% outputdir)
os.mkdir(outputdir)
self.logfile = open(os.path.join(outputdir, "progress.json"), "wb+", 0)
self.json["message"] = "Render starting..."