0

Try to track the capabilities of our outputdir filesystem.

For example, don't chmod if the filesystem dosen't support chmod, and
don't rename over files if that's not supported (this functionality was
already in place).

Should fix #1061
Related to #1055 (we could add a mtime capability flag)
This commit is contained in:
Andrew Chin
2014-02-10 21:37:31 -05:00
parent b88ce263bc
commit d11960ecfb
3 changed files with 78 additions and 44 deletions

View File

@@ -31,7 +31,7 @@ from PIL import Image
from .util import roundrobin
from . import nbt
from .files import FileReplacer
from .files import FileReplacer, get_fs_caps
from .optimizeimages import optimize_image
import rendermodes
import c_overviewer
@@ -357,6 +357,9 @@ class TileSet(object):
self.options['renderchecks'] = 2
os.mkdir(self.outputdir)
# must wait until outputdir exists
self.fs_caps = get_fs_caps(self.outputdir)
if self.options['renderchecks'] == 2:
# Set forcerendertime so that upon an interruption the next render
# will continue where we left off.
@@ -902,7 +905,7 @@ class TileSet(object):
logging.error("While attempting to delete corrupt image %s, an error was encountered. You will need to delete it yourself. Error was '%s'", path[1], e)
# Save it
with FileReplacer(imgpath) as tmppath:
with FileReplacer(imgpath, capabilities=self.fs_caps) as tmppath:
if imgformat == 'jpg':
img.save(tmppath, "jpeg", quality=self.options['imgquality'], subsampling=0)
else: # png
@@ -1006,7 +1009,7 @@ class TileSet(object):
#draw.text((96,96), "c,r: %s,%s" % (col, row), fill='red')
# Save them
with FileReplacer(imgpath) as tmppath:
with FileReplacer(imgpath, capabilities=self.fs_caps) as tmppath:
if self.imgextension == 'jpg':
tileimg.save(tmppath, "jpeg", quality=self.options['imgquality'], subsampling=0)
else: # png