From 19397c0f6b06f0d31eddb61be8577cf96d48f08e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 3 Sep 2024 10:48:52 -0400 Subject: [PATCH] Strip possibly present trailing / before adding one Without that users must have trailing / removed, but nobody checks for that etc. So now we have "raw//" etc, e.g. at https://bids-specification.readthedocs.io/en/latest/derivatives/common-data-types.html#example-use-of-a-descriptionstsv-file With this change it would make it easier on user and guaranteed to render consistently correctly --- tools/examplecode/example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/examplecode/example.py b/tools/examplecode/example.py index efe8232c96..29da732c69 100644 --- a/tools/examplecode/example.py +++ b/tools/examplecode/example.py @@ -69,7 +69,7 @@ def _add_dictionary( # We are dealing with a directory else: - self._tree.append(f"{prefix}{connector} {entry}{os.sep}") + self._tree.append(f"{prefix}{connector} {entry.rstrip(os.sep)}{os.sep}") prefix += ( self.PIPE_PREFIX if index != entries_count - 1 else self.SPACE_PREFIX )