From ef0227cf8954e8289a9dbf4a74439d55993cb112 Mon Sep 17 00:00:00 2001 From: Nik V Date: Thu, 11 Dec 2014 21:21:18 +0800 Subject: [PATCH 1/2] Fix bug with dayone journals on linux --- jrnl/DayOneJournal.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jrnl/DayOneJournal.py b/jrnl/DayOneJournal.py index 6d91a9bd..dfcf01d6 100644 --- a/jrnl/DayOneJournal.py +++ b/jrnl/DayOneJournal.py @@ -58,7 +58,10 @@ class DayOne(Journal.Journal): 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, From b99c82f9beb7e9f791c7a487cba808360fe2683e Mon Sep 17 00:00:00 2001 From: Nik V Date: Thu, 11 Dec 2014 21:28:04 +0800 Subject: [PATCH 2/2] Don't die if you specify a directory (DayOne journal) to install --- jrnl/install.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jrnl/install.py b/jrnl/install.py index dcb83601..138cb826 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -87,7 +87,8 @@ def install_jrnl(config_path='~/.jrnl_config'): 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: