Detectsa DayOne journals that are stored in the Mobile Documents folder

This commit is contained in:
Manuel Ebert 2013-08-28 12:18:39 -07:00
parent d50e55480a
commit c849b03c5c

View file

@ -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/")):
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)