Change default config to use journal key instead of journal name as key for file path (#1594)

This commit is contained in:
Micah Jerome Ellison 2022-10-08 13:41:22 -07:00 committed by GitHub
parent dd7f59cef7
commit ceff398a01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -91,7 +91,7 @@ def get_config_path():
def get_default_config(): def get_default_config():
return { return {
"version": __version__, "version": __version__,
"journals": {"default": get_default_journal_path()}, "journals": {"default": {"journal": get_default_journal_path()}},
"editor": os.getenv("VISUAL") or os.getenv("EDITOR") or "", "editor": os.getenv("VISUAL") or os.getenv("EDITOR") or "",
"encrypt": False, "encrypt": False,
"template": False, "template": False,

View file

@ -122,10 +122,10 @@ def install():
) )
journal_path = absolute_path(user_given_path or default_journal_path) journal_path = absolute_path(user_given_path or default_journal_path)
default_config = get_default_config() default_config = get_default_config()
default_config["journals"][DEFAULT_JOURNAL_KEY] = journal_path default_config["journals"][DEFAULT_JOURNAL_KEY]["journal"] = journal_path
# If the folder doesn't exist, create it # If the folder doesn't exist, create it
path = os.path.split(default_config["journals"][DEFAULT_JOURNAL_KEY])[0] path = os.path.split(journal_path)[0]
try: try:
os.makedirs(path) os.makedirs(path)
except OSError: except OSError:

View file

@ -118,7 +118,7 @@ def output_should_be_columns_wide(cli_run, width):
) )
) )
def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir): def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir):
default_journal_path = config_on_disk["journals"]["default"] default_journal_path = config_on_disk["journals"]["default"]["journal"]
expected_journal_path = ( expected_journal_path = (
os.path.join(temp_dir.name, journal_file) os.path.join(temp_dir.name, journal_file)
if journal_dir == "." if journal_dir == "."