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:
@@ -256,11 +256,10 @@ class JSObserver(Observer):
|
|||||||
raise Exception("JSObserver: messages parameter must be a "
|
raise Exception("JSObserver: messages parameter must be a "
|
||||||
"dictionary with three entries: totalTiles, "
|
"dictionary with three entries: totalTiles, "
|
||||||
"renderCompleted and renderProgress")
|
"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):
|
if not os.path.exists(outputdir):
|
||||||
raise Exception("JSObserver: Output directory specified (%s) "
|
os.mkdir(outputdir)
|
||||||
"doesn't appear to exist. This should be the "
|
|
||||||
"same as the Overviewer output directory"
|
|
||||||
% outputdir)
|
|
||||||
|
|
||||||
self.logfile = open(os.path.join(outputdir, "progress.json"), "wb+", 0)
|
self.logfile = open(os.path.join(outputdir, "progress.json"), "wb+", 0)
|
||||||
self.json["message"] = "Render starting..."
|
self.json["message"] = "Render starting..."
|
||||||
|
|||||||
Reference in New Issue
Block a user