#6 Expand and replace home directory

Merged
ryanreed merged 1 commits from expanduser into master 2 years ago
  1. +1
    -1
      pyproject.toml
  2. +2
    -2
      src/transpose/transpose.py
  3. +5
    -1
      src/transpose/utils.py

+ 1
- 1
pyproject.toml View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "transpose"
version = "1.0.0"
version = "1.0.1"
description = "Move and symlink a path"
authors = ["Ryan Reed"]
license = "GPLv3"


+ 2
- 2
src/transpose/transpose.py View File

@ -29,7 +29,7 @@ class Transpose:
)
cache = get_cache(self.cache_path)
original_path = pathlib.Path(cache["original_path"])
original_path = pathlib.Path(cache["original_path"]).expanduser()
if original_path.is_symlink():
remove(original_path)
@ -67,7 +67,7 @@ class Transpose:
raise TransposeError(f"Target path does not exist: {self.target_path}")
cache = get_cache(self.cache_path)
original_path = pathlib.Path(cache["original_path"])
original_path = pathlib.Path(cache["original_path"]).expanduser()
if original_path.is_symlink():
remove(original_path)


+ 5
- 1
src/transpose/utils.py View File

@ -41,7 +41,11 @@ def create_cache(cache_path: Path, original_path: Path) -> None:
Returns:
None
"""
template = {"version": version, "original_path": str(original_path.absolute())}
template = {
"version": version,
"original_path": str(original_path.absolute()).replace(str(Path.home()), "~"),
}
with open(str(cache_path), "w") as f:
json.dump(template, f)


Loading…
Cancel
Save