refactor: drop display path exception guard

This commit is contained in:
banteg
2025-12-29 18:22:53 +04:00
parent 9eccd99a93
commit b0ac7e8e3e
+6 -9
View File
@@ -17,15 +17,12 @@ _EXAMPLE_CONFIG = (
def _display_path(path: Path) -> str: def _display_path(path: Path) -> str:
try: cwd = Path.cwd()
cwd = Path.cwd() if path.is_relative_to(cwd):
if path.is_relative_to(cwd): return f"./{path.relative_to(cwd).as_posix()}"
return f"./{path.relative_to(cwd).as_posix()}" home = Path.home()
home = Path.home() if path.is_relative_to(home):
if path.is_relative_to(home): return f"~/{path.relative_to(home).as_posix()}"
return f"~/{path.relative_to(home).as_posix()}"
except Exception:
return str(path)
return str(path) return str(path)