Consistently use strings for paths instead of some strings and some pathlib.Path

This commit is contained in:
Micah Jerome Ellison 2023-05-06 14:36:01 -07:00
parent 39e7dc91ee
commit 0809d28ba2

View file

@ -2,7 +2,6 @@
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import os.path import os.path
from pathlib import Path
import xdg.BaseDirectory import xdg.BaseDirectory
@ -40,8 +39,8 @@ def get_templates_path() -> str:
doesn't exist. doesn't exist.
""" """
# jrnl_xdg_resource_path is created by save_data_path if it does not exist # jrnl_xdg_resource_path is created by save_data_path if it does not exist
jrnl_xdg_resource_path = Path(xdg.BaseDirectory.save_data_path(XDG_RESOURCE)) jrnl_xdg_resource_path = xdg.BaseDirectory.save_data_path(XDG_RESOURCE)
jrnl_templates_path = jrnl_xdg_resource_path / "templates" jrnl_templates_path = os.path.join(jrnl_xdg_resource_path, "templates")
# Create the directory if needed. # Create the directory if needed.
jrnl_templates_path.mkdir(exist_ok=True) jrnl_templates_path.mkdir(exist_ok=True)
return str(jrnl_templates_path) return str(jrnl_templates_path)
@ -64,9 +63,9 @@ def get_config_directory() -> str:
) )
def get_config_path() -> Path: def get_config_path() -> str:
try: try:
config_directory_path = get_config_directory() config_directory_path = get_config_directory()
except JrnlException: except JrnlException:
return Path(home_dir(), DEFAULT_CONFIG_NAME) return os.path.join(home_dir(), DEFAULT_CONFIG_NAME)
return Path(config_directory_path, DEFAULT_CONFIG_NAME) return os.path.join(config_directory_path, DEFAULT_CONFIG_NAME)