Skip to content

Commit

Permalink
Fix T48187: Packing files on MS-Windows fails
Browse files Browse the repository at this point in the history
Using paths on different drives caused packing to fail
since its not possible to make one path relative to another.
  • Loading branch information
ideasman42 committed Jul 19, 2016
1 parent 432787c commit 2155eb5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion io_blend_utils/blendfile_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,18 @@ def _relpath_remap(
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)
if os.name != "nt":
path_dst = os.path.relpath(path_src, base_dir_src)
else:
# exception for windows, we need to support mapping between drives
try:
path_dst = os.path.relpath(path_src, base_dir_src)
except ValueError:
# include the absolute path when the file is on a different drive.
path_dst = os.path.relpath(
os.path.join(base_dir_src, b'__' + path_src.replace(b':', b'\\')),
base_dir_src,
)

if blendfile_src_dir_fakeroot is None:
# /foo/../bar.png --> /foo/__/bar.png
Expand Down

0 comments on commit 2155eb5

Please sign in to comment.