From 113b0c9bb8607472be8232d0f806b28fa232d399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 26 Jun 2019 14:35:43 +0200 Subject: [PATCH] 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. --- CHANGELOG.md | 1 + blender_asset_tracer/pack/__init__.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f91e1a8..db5b9fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/blender_asset_tracer/pack/__init__.py b/blender_asset_tracer/pack/__init__.py index c48a9ed..52561e3 100644 --- a/blender_asset_tracer/pack/__init__.py +++ b/blender_asset_tracer/pack/__init__.py @@ -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.