mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-30 22:46:12 +02:00
Always expand all paths (journals, templates, etc) (#1468)
* Refactored path expansion calls into a new path.py file This also fixed bugs with relative journal and template paths. * Update tests for new path functions Also, make the tests specific to Windows, Mac & Linux Co-authored-by: Jonathan Wren <jonathan@nowandwren.com> Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
1ce7ce8bfc
commit
ea6df4705c
9 changed files with 172 additions and 21 deletions
|
@ -15,6 +15,7 @@ from jrnl.messages import MsgType
|
|||
from .color import ERROR_COLOR
|
||||
from .color import RESET_COLOR
|
||||
from .output import list_journals
|
||||
from .path import home_dir
|
||||
|
||||
# Constants
|
||||
DEFAULT_CONFIG_NAME = "jrnl.yaml"
|
||||
|
@ -83,9 +84,7 @@ def get_config_path():
|
|||
),
|
||||
)
|
||||
|
||||
return os.path.join(
|
||||
config_directory_path or os.path.expanduser("~"), DEFAULT_CONFIG_NAME
|
||||
)
|
||||
return os.path.join(config_directory_path or home_dir(), DEFAULT_CONFIG_NAME)
|
||||
|
||||
|
||||
def get_default_config():
|
||||
|
@ -112,9 +111,7 @@ def get_default_config():
|
|||
|
||||
|
||||
def get_default_journal_path():
|
||||
journal_data_path = xdg.BaseDirectory.save_data_path(
|
||||
XDG_RESOURCE
|
||||
) or os.path.expanduser("~")
|
||||
journal_data_path = xdg.BaseDirectory.save_data_path(XDG_RESOURCE) or home_dir()
|
||||
return os.path.join(journal_data_path, DEFAULT_JOURNAL_NAME)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue