Skip to content

Commit

Permalink
Merge pull request #342 from bids-standard/fix-validation-paths
Browse files Browse the repository at this point in the history
Fix path validation.
  • Loading branch information
effigies authored Feb 1, 2019
2 parents f2a333c + 9f1722f commit 6984cdd
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions bids/layout/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,14 @@ def _validate_file(self, f):
if not self.validate:
return True

# For derivatives, we need to cheat a bit and construct a fake
# derivatives path--prepend 'derivatives' and the pipeline name
to_check = os.path.relpath(f, self.root)
# Derivatives are currently not validated.
if 'derivatives' in self.domains:
to_check = os.path.join(
'derivatives', self.description['PipelineDescription']['Name'],
to_check)
return True

sep = os.path.sep
if to_check[:len(sep)] != sep:
to_check = sep + to_check
# BIDS validator expects absolute paths, but really these are relative
# to the BIDS project root.
to_check = os.path.relpath(f, self.root)
to_check = os.path.join(os.path.sep, to_check)

return self.validator.is_bids(to_check)

Expand Down

0 comments on commit 6984cdd

Please sign in to comment.