ref: Rename path expansion function
From `_real_path` to `_expand_path` to better express its use.
This commit is contained in:
parent
49bd1292fa
commit
3f10b429a2
1 changed files with 9 additions and 9 deletions
18
topen.py
18
topen.py
|
|
@ -133,7 +133,7 @@ class Opt:
|
||||||
is_flag: bool = False
|
is_flag: bool = False
|
||||||
|
|
||||||
|
|
||||||
def _real_path(p: Path | str) -> Path:
|
def _expand_path(p: Path | str) -> Path:
|
||||||
return Path(os.path.expandvars(p)).expanduser()
|
return Path(os.path.expandvars(p)).expanduser()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -143,11 +143,11 @@ def _ensure_parent_dir(file: Path) -> None:
|
||||||
|
|
||||||
|
|
||||||
def _determine_default_task_rc() -> Path:
|
def _determine_default_task_rc() -> Path:
|
||||||
if _real_path("~/.taskrc").exists():
|
if _expand_path("~/.taskrc").exists():
|
||||||
return _real_path("~/.taskrc")
|
return _expand_path("~/.taskrc")
|
||||||
if _real_path("$XDG_CONFIG_HOME/task/taskrc").exists():
|
if _expand_path("$XDG_CONFIG_HOME/task/taskrc").exists():
|
||||||
return _real_path("$XDG_CONFIG_HOME/task/taskrc")
|
return _expand_path("$XDG_CONFIG_HOME/task/taskrc")
|
||||||
return _real_path("~/.config/task/taskrc")
|
return _expand_path("~/.config/task/taskrc")
|
||||||
|
|
||||||
|
|
||||||
def _strtobool(val: str) -> bool:
|
def _strtobool(val: str) -> bool:
|
||||||
|
|
@ -261,11 +261,11 @@ class TConf:
|
||||||
"""If set topen will give no feedback on note editing."""
|
"""If set topen will give no feedback on note editing."""
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
self.task_rc = _real_path(self.task_rc)
|
self.task_rc = _expand_path(self.task_rc)
|
||||||
self.task_data = _real_path(self.task_data)
|
self.task_data = _expand_path(self.task_data)
|
||||||
if self.notes_dir == NON_EXISTENT_PATH:
|
if self.notes_dir == NON_EXISTENT_PATH:
|
||||||
self.notes_dir = self._default_notes_dir()
|
self.notes_dir = self._default_notes_dir()
|
||||||
self.notes_dir = _real_path(self.notes_dir)
|
self.notes_dir = _expand_path(self.notes_dir)
|
||||||
if not self.notes_editor:
|
if not self.notes_editor:
|
||||||
self.notes_editor = (
|
self.notes_editor = (
|
||||||
os.getenv("EDITOR")
|
os.getenv("EDITOR")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue