Skip to content

Commit

Permalink
Merge pull request #325 from nikvdp/master
Browse files Browse the repository at this point in the history
Correct issue #259, also fix issue with specifying DayOne journals in install
  • Loading branch information
maebert committed Jan 11, 2015
2 parents 205269a + d0e49d2 commit 15ef974
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion jrnl/DayOneJournal.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ def write(self):
if not hasattr(entry, "uuid"):
entry.uuid = uuid.uuid1().hex
utc_time = datetime.utcfromtimestamp(time.mktime(entry.date.timetuple()))
filename = os.path.join(self.config['journal'], "entries", entry.uuid + ".doentry")
# make sure to upper() the uuid since uuid.uuid1 returns a lowercase string by default
# while dayone uses uppercase by default. On fully case preserving filesystems (e.g.
# linux) this results in duplicated entries when we save the file
filename = os.path.join(self.config['journal'], "entries", entry.uuid.upper() + ".doentry")
entry_plist = {
'Creation Date': utc_time,
'Starred': entry.starred if hasattr(entry, 'starred') else False,
Expand Down
3 changes: 2 additions & 1 deletion jrnl/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def autocomplete(text, state):
except OSError:
pass

open(default_config['journals']['default'], 'a').close() # Touch to make sure it's there
if not os.path.isdir(path): # if it's a directory and exists (e.g. a DayOne journal, let it be)
open(default_config['journals']['default'], 'a').close() # Touch to make sure it's there

# Write config to ~/.jrnl_conf
with open(config_path, 'w') as f:
Expand Down

0 comments on commit 15ef974

Please sign in to comment.