From cd32442f5aef4b8c22e86859de742f415c7d5d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 20 Mar 2018 17:57:41 +0100 Subject: [PATCH] Fixed issues with relative paths to blend files --- blender_asset_tracer/cli/pack.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blender_asset_tracer/cli/pack.py b/blender_asset_tracer/cli/pack.py index 0bb3d1a..0c868f6 100644 --- a/blender_asset_tracer/cli/pack.py +++ b/blender_asset_tracer/cli/pack.py @@ -106,6 +106,7 @@ def paths_from_cli(args) -> typing.Tuple[pathlib.Path, pathlib.Path, pathlib.Pat if bpath.is_dir(): log.critical('%s is a directory, should be a blend file') sys.exit(3) + bpath = bpath.absolute().resolve() tpath = args.target if tpath.exists() and not tpath.is_dir(): @@ -113,22 +114,21 @@ def paths_from_cli(args) -> typing.Tuple[pathlib.Path, pathlib.Path, pathlib.Pat sys.exit(4) if args.project is None: - ppath = bpath.absolute().parent + ppath = bpath.absolute().parent.resolve() log.warning('No project path given, using %s', ppath) else: - ppath = args.project + ppath = args.project.absolute().resolve() if not ppath.exists(): log.critical('Project directory %s does not exist', ppath) sys.exit(5) - ppath = ppath.absolute().resolve() if not ppath.is_dir(): log.warning('Project path %s is not a directory; using the parent %s', ppath, ppath.parent) ppath = ppath.parent try: - bpath.absolute().relative_to(ppath) + bpath.relative_to(ppath) except ValueError: log.critical('Project directory %s does not contain blend file %s', args.project, bpath.absolute())