diff --git a/scripts/wk/clone/ddrescue.py b/scripts/wk/clone/ddrescue.py index 29610988..de6a94d1 100644 --- a/scripts/wk/clone/ddrescue.py +++ b/scripts/wk/clone/ddrescue.py @@ -348,9 +348,8 @@ class State(): self.progress_out: pathlib.Path = self.log_dir.joinpath('progress.out') self.mode: str = '?' self.source: hw_disk.Disk | None = None - self.working_dir: pathlib.Path = pathlib.Path() + self.working_dir: pathlib.Path | None = None self.ui: tui.TUI = tui.TUI('Source') - self.ui.add_title_pane('Destination') def _add_block_pair(self, source: hw_disk.Disk, destination: pathlib.Path) -> None: """Add BlockPair object and run safety checks.""" @@ -655,7 +654,7 @@ class State(): keep_history=True, timestamp=False, ) - self.ui.set_progress_file(self.progress_out) + self.ui.set_progress_file(str(self.progress_out)) # Set mode self.mode = set_mode(docopt_args) @@ -1109,13 +1108,14 @@ class State(): ), source_str, ) - self.ui.add_title_pane( - ansi.color_string( - ['Destination', '' if dest_exists else ' (Missing)'], - ['BLUE', 'RED'], - ), - dest_str, - ) + if dest_str: + self.ui.add_title_pane( + ansi.color_string( + ['Destination', '' if dest_exists else ' (Missing)'], + ['BLUE', 'RED'], + ), + dest_str, + ) # Functions @@ -1620,6 +1620,8 @@ def get_object(path) -> hw_disk.Disk | pathlib.Path: obj = None # Bail early + if path is None: + return obj if not path: raise FileNotFoundError(f'Path provided does not exist: {path}')