From 7a209ba558a260b91e4275f238dab94847c91d8c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Dec 2014 11:33:15 +0100 Subject: [PATCH] correct asserts packing blend files - absolute windows paths made packing fail - files with '.blend' in the path name would assert --- modules/blendfile_pack.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/blendfile_pack.py b/modules/blendfile_pack.py index 3a4306d..7b321f9 100755 --- a/modules/blendfile_pack.py +++ b/modules/blendfile_pack.py @@ -54,7 +54,16 @@ def _relpath_remap( ): import os - assert(os.path.isabs(path_src)) + + if not os.path.isabs(path_src): + # Absolute win32 paths on a unix system + # cause bad issues! + if len(path_src) >= 2: + if path_src[0] != b'/'[0] and path_src[1] == b':'[0]: + pass + else: + raise Exception("Internal error 'path_src' -> %r must be absolute" % path_src) + path_src = os.path.normpath(path_src) path_dst = os.path.relpath(path_src, base_dir_src) @@ -327,7 +336,7 @@ def pack( shutil.rmtree(base_dir_dst_temp) for src, dst in path_copy_files: - assert(b'.blend' not in dst) + assert(not dst.endswith(b'.blend')) if not os.path.exists(src): yield report(" %s: %r\n" % (colorize("source missing", color='red'), src))