Fix T65904: External files with same path on different drives are packed once

External files with the same path on different drives are packed as a
single file. In this commit the drive letter is taken into account when
determining the path inside `_outside_project`, so that they are distinct.
This commit is contained in:
Sybren A. Stüvel 2019-06-26 14:35:43 +02:00
parent f0836417a4
commit 113b0c9bb8
2 changed files with 11 additions and 2 deletions

View File

@ -7,6 +7,7 @@ changed functionality, fixed bugs).
- Migrated from Pipenv to Poetry for managing Python package dependencies.
- Windows compatibility fix when using mapped network storage.
- Windows compatibility fix when using different assets with the same path but on different drives.
## Version 1.1.1 (2019-04-18)

View File

@ -329,8 +329,16 @@ class Packer:
for path in self._new_location_paths:
act = self._actions[path]
assert isinstance(act, AssetAction)
# Like a join, but ignoring the fact that 'path' is absolute.
act.new_path = pathlib.Path(self._target_path, '_outside_project', *path.parts[1:])
# Remove the base of the path, effectively removing the 'absoluteness'.
# On POSIX this turns '/path/file.txt' into 'path/file.txt'.
# On Windows this turns 'X:/path/file.txt' into 'X/path/file.txt'.
if path.drive:
path_parts = (path.drive[0], *path.parts[1:])
else:
path_parts = path.parts[1:]
act.new_path = pathlib.Path(self._target_path, '_outside_project', *path_parts)
def _group_rewrites(self) -> None:
"""For each blend file, collect which fields need rewriting.