Made sure that the destination directory will exist

This commit is contained in:
SpirosChadoulos 2017-05-11 12:11:21 +03:00
parent f5b23fffd4
commit 0dc948d9d3
2 changed files with 9 additions and 2 deletions

View file

@ -1481,13 +1481,18 @@ def move_items(lib, dest, query, copy, album, pretend, export=False,
for obj in objs])
else:
if export:
if album:
for obj in objs:
for item in obj.items():
# Create necessary ancestry for the copy.
util.mkdirall(item.destination(basedir=dest))
util.copy(item.path, item.destination(basedir=dest))
else:
for item in objs:
util.copy(item.path, item.destination(basedir=dest))
for obj in objs:
# Create necessary ancestry for the copy.
util.mkdirall(obj.destination(basedir=dest))
util.copy(obj.path, obj.destination(basedir=dest))
if confirm:
objs = ui.input_select_objects(
u'Really %s' % act, objs,

View file

@ -543,6 +543,8 @@ class ExportTest(_common.TestCase):
self.assertExists(self.i.path)
self.assertExists(self.itempath)
def test_pretend_move_item(self):
self._move(dest=self.otherdir, pretend=True)
self.i.load()