Skip to content

Commit

Permalink
fix: common prefix for tree
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Nov 21, 2024
1 parent f5d97d0 commit a940969
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/imgtools/dicom/sort/dicomsorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,16 @@ def _dry_run(self, file_map: Dict[Path, Path]) -> None:
)

new_paths = sorted(list(file_map.values()))
common_prefix: Path = self._common_prefix(new_paths)
ppa = Path(self.pattern_preview).absolute()
common_prefix: Path = self._common_prefix([ppa, *new_paths])
common_prefix_styled = f'[bold yellow]{common_prefix}[/bold yellow]'
self._console.print(f'\nCommon Prefix: :file_folder:{common_prefix_styled}\n\n')

tree = self._setup_tree(Path(common_prefix_styled))

root = ppa.relative_to(common_prefix).as_posix()
self._generate_tree_structure(
Path(self.pattern_preview).absolute().relative_to(common_prefix).as_posix(),
root,
tree,
)
self._build_tree(new_paths, tree, common_prefix)
Expand Down

0 comments on commit a940969

Please sign in to comment.