Skip to content

Commit

Permalink
Merge pull request #1921 from yarikoptic/bf-nodoubleslash
Browse files Browse the repository at this point in the history
Strip possibly present trailing / (os.sep) before adding one
  • Loading branch information
rwblair committed Sep 10, 2024
2 parents 7ce4276 + 81e7a43 commit 3fc4f65
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/examplecode/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import os
import posixpath


class DirectoryTree:
Expand Down Expand Up @@ -69,7 +69,9 @@ 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(posixpath.sep)}{posixpath.sep}"
)
prefix += (
self.PIPE_PREFIX if index != entries_count - 1 else self.SPACE_PREFIX
)
Expand Down

0 comments on commit 3fc4f65

Please sign in to comment.