diff options
Diffstat (limited to 'src/hydrilla/builder/build.py')
-rw-r--r-- | src/hydrilla/builder/build.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hydrilla/builder/build.py b/src/hydrilla/builder/build.py index 44f3dd9..89c1f5a 100644 --- a/src/hydrilla/builder/build.py +++ b/src/hydrilla/builder/build.py @@ -200,11 +200,13 @@ class Build: path = piggybacked.resolve_file(desired_path) if path is None: path = (self.srcdir / desired_path).resolve() - if not path.is_relative_to(self.srcdir): + try: + rel_path = path.relative_to(self.srcdir) + except ValueError: raise FileReferenceError(_('loading_{}_outside_package_dir') .format(filename)) - if str(path.relative_to(self.srcdir)) == 'index.json': + if str(rel_path) == 'index.json': raise FileReferenceError(_('loading_reserved_index_json')) else: include_in_source_archive = False |