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

13
jrnl/path.py Normal file
View file

@ -0,0 +1,13 @@
import os.path
def home_dir():
return os.path.expanduser("~")
def expand_path(path):
return os.path.expanduser(os.path.expandvars(path))
def absolute_path(path):
return os.path.abspath(expand_path(path))