From c849b03c5c926c836d496a80f7ff4a9c0508a333 Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Wed, 28 Aug 2013 12:18:39 -0700 Subject: [PATCH] Detectsa DayOne journals that are stored in the Mobile Documents folder --- jrnl/jrnl.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index 97c01d74..66ac4feb 100755 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -150,13 +150,16 @@ def cli(manual_args=None): mode_compose, mode_export = guess_mode(args, config) # open journal file or folder - if os.path.isdir(config['journal']) and ( config['journal'].endswith(".dayone") or \ - config['journal'].endswith(".dayone/")): - journal = Journal.DayOne(**config) + if os.path.isdir(config['journal']): + if config['journal'].strip("/").endswith(".dayone") or \ + "entries" in os.listdir(config['journal']): + journal = Journal.DayOne(**config) + else: + util.prompt("[Error: {} is a directory, but doesn't seem to be a DayOne journal either.".format(config['journal'])) + sys.exit(-1) else: journal = Journal.Journal(**config) - if mode_compose and not args.text: if config['editor']: raw = get_text_from_editor(config)