Added --relative-only option to bat pack command

This makes BAT skip assets that are referred to with an absolute path.
It is assumed that the receiver of the BAT pack can access those assets
at the same path.
This commit is contained in:
Sybren A. Stüvel
2018-12-06 10:02:14 +01:00
parent 041af5d3bb
commit 37ad8f8dfc
4 changed files with 41 additions and 3 deletions
+7 -1
View File
@@ -99,12 +99,14 @@ class Packer:
target: pathlib.Path,
*,
noop=False,
compress=False) -> None:
compress=False,
relative_only=False) -> None:
self.blendfile = bfile
self.project = project
self.target = target
self.noop = noop
self.compress = compress
self.relative_only = relative_only
self._aborted = threading.Event()
self._abort_lock = threading.RLock()
@@ -233,6 +235,10 @@ class Packer:
log.info('Excluding file: %s', asset_path)
continue
if self.relative_only and not usage.asset_path.startswith(b'//'):
log.info('Skipping absolute path: %s', usage.asset_path)
continue
if usage.is_sequence:
self._visit_sequence(asset_path, usage)
else: