diff options
author | Manuel Ebert <manuel@1450.me> | 2014-06-26 15:19:38 +0200 |
---|---|---|
committer | Manuel Ebert <manuel@1450.me> | 2014-06-26 15:19:38 +0200 |
commit | 0a59dc198dc3b4b25a723319ae08913ce6cf505a (patch) | |
tree | 929ce202087e599143ef83d46d68f75226d43ac2 | |
parent | cb1561481b2fb7a71da669cd69073ca69e5c5c9d (diff) | |
parent | 7d782261e0ddb942afe1810131f19fe00d58775e (diff) |
Merge pull request #204 from chrissexton/parallel_edits
Allow parallel edits
-rw-r--r-- | jrnl/cli.py | 22 | ||||
-rw-r--r-- | jrnl/util.py | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/jrnl/cli.py b/jrnl/cli.py index b73fd675..46cecb09 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -159,17 +159,6 @@ def run(manual_args=None): touch_journal(config['journal']) mode_compose, mode_export = guess_mode(args, config) - # open journal file or folder - if os.path.isdir(config['journal']): - if config['journal'].strip("/").endswith(".dayone") or \ - "entries" in os.listdir(config['journal']): - journal = DayOneJournal.DayOne(**config) - else: - util.prompt(u"[Error: {0} is a directory, but doesn't seem to be a DayOne journal either.".format(config['journal'])) - sys.exit(1) - else: - journal = Journal.Journal(journal_name, **config) - # How to quit writing? if "win32" in sys.platform: _exit_multiline_code = "on a blank line, press Ctrl+Z and then Enter" @@ -189,6 +178,17 @@ def run(manual_args=None): else: mode_compose = False + # open journal file or folder + if os.path.isdir(config['journal']): + if config['journal'].strip("/").endswith(".dayone") or \ + "entries" in os.listdir(config['journal']): + journal = DayOneJournal.DayOne(**config) + else: + util.prompt(u"[Error: {0} is a directory, but doesn't seem to be a DayOne journal either.".format(config['journal'])) + sys.exit(1) + else: + journal = Journal.Journal(journal_name, **config) + # Writing mode if mode_compose: raw = " ".join(args.text).strip() diff --git a/jrnl/util.py b/jrnl/util.py index 315666b3..9c8aaa40 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -114,7 +114,7 @@ def load_and_fix_json(json_path): sys.exit(1) def get_text_from_editor(config, template=""): - tmpfile = os.path.join(tempfile.gettempdir(), "jrnl") + tmpfile = os.path.join(tempfile.mktemp(prefix="jrnl")) with codecs.open(tmpfile, 'w', "utf-8") as f: if template: f.write(template) |