From b035757d3b49a5778a12c98ce9d4548b2d0d3051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 17 Jan 2017 17:02:05 +0100 Subject: [PATCH] Fix: fail to move lib blend files to the destination dir when mode=FILE --- bam/blend/blendfile_pack.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bam/blend/blendfile_pack.py b/bam/blend/blendfile_pack.py index a8caa40..1600a22 100755 --- a/bam/blend/blendfile_pack.py +++ b/bam/blend/blendfile_pack.py @@ -502,9 +502,13 @@ def pack( shutil.move(blendfile_dst_tmp, blendfile_dst) path_temp_files.remove(blendfile_dst_tmp) - # strip TEMP_SUFFIX + # strip TEMP_SUFFIX and move to the destination directory. for fn in path_temp_files: - shutil.move(fn, fn[:-len(TEMP_SUFFIX)]) + dst_rel, _ = _relpath_remap(fn[:-len(TEMP_SUFFIX)], base_dir_dst_temp, base_dir_dst, None) + dst = os.path.join(base_dir_dst, dst_rel) + yield report(" %s: %r -> %r\n" % (colorize("moving", color='blue'), fn, dst)) + os.makedirs(os.path.dirname(dst), exist_ok=True) + shutil.move(fn, dst) for src, dst in path_copy_files: assert(b'.blend' not in dst)