correct path remapping
This commit is contained in:
@@ -134,10 +134,10 @@ def pack(blendfile_src, blendfile_dst, mode='FILE',
|
|||||||
del blendfile_src_basename, blendfile_dst_basename
|
del blendfile_src_basename, blendfile_dst_basename
|
||||||
|
|
||||||
# store path mapping {dst: src}
|
# store path mapping {dst: src}
|
||||||
if paths_remap:
|
if paths_remap is not None:
|
||||||
for src, dst in path_copy_files:
|
for src, dst in path_copy_files:
|
||||||
# TODO. relative to project-basepath
|
# TODO. relative to project-basepath
|
||||||
paths_remap[os.path.relpath(dst, base_dir_dst).decode('utf-8')] = src
|
paths_remap[os.path.relpath(dst, base_dir_dst).decode('utf-8')] = src.decode('utf-8')
|
||||||
# paths_remap[os.path.relpath(dst, base_dir_dst)] = blendfile_src
|
# paths_remap[os.path.relpath(dst, base_dir_dst)] = blendfile_src
|
||||||
|
|
||||||
# --------------------
|
# --------------------
|
||||||
@@ -231,15 +231,8 @@ def main():
|
|||||||
|
|
||||||
encoding = sys.getfilesystemencoding()
|
encoding = sys.getfilesystemencoding()
|
||||||
|
|
||||||
if args.deps_remap:
|
deps_remap = {} if args.deps_remap else None
|
||||||
deps_remap = {}
|
paths_remap = {} if args.paths_remap else None
|
||||||
else:
|
|
||||||
deps_remap = None
|
|
||||||
|
|
||||||
if args.paths_remap:
|
|
||||||
paths_remap = {}
|
|
||||||
else:
|
|
||||||
paths_remap = None
|
|
||||||
|
|
||||||
pack(args.path_src.encode(encoding),
|
pack(args.path_src.encode(encoding),
|
||||||
args.path_dst.encode(encoding),
|
args.path_dst.encode(encoding),
|
||||||
@@ -258,5 +251,15 @@ def main():
|
|||||||
sort_keys=True, indent=4, separators=(',', ': '),
|
sort_keys=True, indent=4, separators=(',', ': '),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if paths_remap is not None:
|
||||||
|
import json
|
||||||
|
|
||||||
|
with open(args.paths_remap, 'w', encoding='utf-8') as f:
|
||||||
|
json.dump(
|
||||||
|
paths_remap, f, ensure_ascii=False,
|
||||||
|
# optional (pretty)
|
||||||
|
sort_keys=True, indent=4, separators=(',', ': '),
|
||||||
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Reference in New Issue
Block a user