From 528b7c2102f1fe6b36f66859d09df6fd65b1990e Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Tue, 30 Jul 2024 15:07:24 +0200 Subject: [PATCH] Expand the tilde --- cli/pyproject.toml | 2 +- cli/trd.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/pyproject.toml b/cli/pyproject.toml index 852e471..eb95c4e 100644 --- a/cli/pyproject.toml +++ b/cli/pyproject.toml @@ -6,7 +6,7 @@ requires = [ [project] name = "traduire-cli" -version = "0.0.4" +version = "0.0.5" description = "Traduire CLI" readme = "README.md" authors = [ diff --git a/cli/trd.py b/cli/trd.py index 517a9a1..f94fdef 100644 --- a/cli/trd.py +++ b/cli/trd.py @@ -89,10 +89,11 @@ def current_project(): _terminate(f"Config file {config} doesn't exist.") data = tomllib.loads(config.read_text()) - cwd = str(Path.cwd()).rstrip("/") + cwd = Path.cwd() for project in data.get("project", ()): - if project["path"].rstrip("/") == cwd: + path = Path(project["path"]).expanduser() + if path == cwd: return project _terminate(f"Couldn't find a project for the current working directory {cwd}") # noqa: RET503