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:
Kevin 2022-05-21 14:06:07 -07:00 committed by GitHub
parent 1ce7ce8bfc
commit ea6df4705c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 172 additions and 21 deletions

View file

@ -11,6 +11,7 @@ import sys
from . import Entry
from . import time
from .prompt import yesno
from .path import expand_path
class Tag:
@ -410,7 +411,7 @@ def open_journal(journal_name, config, legacy=False):
backwards compatibility with jrnl 1.x
"""
config = config.copy()
config["journal"] = os.path.expanduser(os.path.expandvars(config["journal"]))
config["journal"] = expand_path(config["journal"])
if os.path.isdir(config["journal"]):
if config["encrypt"]: