mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-21 05:28:31 +02:00
fix twice version validation
This commit is contained in:
parent
4df9b2b375
commit
29e67bbcef
3 changed files with 3 additions and 11 deletions
|
@ -100,7 +100,7 @@ def load_or_install_jrnl():
|
|||
from . import upgrade
|
||||
|
||||
try:
|
||||
upgrade.upgrade_jrnl_if_necessary(config_path)
|
||||
upgrade.upgrade_jrnl(config_path)
|
||||
except upgrade.UpgradeValidationException:
|
||||
print("Aborting upgrade.", file=sys.stderr)
|
||||
print(
|
||||
|
|
|
@ -34,12 +34,7 @@ def check_exists(path):
|
|||
return os.path.exists(path)
|
||||
|
||||
|
||||
def upgrade_jrnl_if_necessary(config_path):
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
config_file = f.read()
|
||||
if not config_file.strip().startswith("{"):
|
||||
return
|
||||
|
||||
def upgrade_jrnl(config_path):
|
||||
config = util.load_config(config_path)
|
||||
|
||||
print(
|
||||
|
|
|
@ -126,10 +126,7 @@ def load_config(config_path):
|
|||
def is_config_json(config_path):
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
config_file = f.read()
|
||||
if not config_file.strip().startswith("{"):
|
||||
return False
|
||||
|
||||
return True
|
||||
return config_file.strip().startswith("{"):
|
||||
|
||||
|
||||
def is_old_version(config_path):
|
||||
|
|
Loading…
Add table
Reference in a new issue