summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-10-14 17:05:11 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-10-14 17:05:11 +0100
commit803e86f545bd62045a843e1f985c0a481fb23f68 (patch)
tree3633c6289e05882c48bf247b1125609223eba812
parentad6e2bf2aa5fdc4b774db1c37e8298ec9658ba7e (diff)
downloadjt-803e86f545bd62045a843e1f985c0a481fb23f68.tar.gz
Create drafts and published dirs if missing
-rwxr-xr-xjt6
1 files changed, 6 insertions, 0 deletions
diff --git a/jt b/jt
index cfc5dab..841f75b 100755
--- a/jt
+++ b/jt
@@ -67,6 +67,9 @@ class JournalTool(cliapp.Application):
self.settings.require('source')
self.settings.require('layout')
+ if not os.path.exists(self.drafts_dir()):
+ os.mkdir(self.drafts_dir())
+
for i in range(1000):
name = self.draft_name(i)
if not os.path.exists(name):
@@ -186,6 +189,9 @@ class JournalTool(cliapp.Application):
if os.path.exists(pub_mdwn):
raise cliapp.AppException('%s already exists' % pub_mdwn)
+
+ if not os.path.exists(self.published_dir()):
+ os.mkdir(self.published_dir())
os.rename(draft_mdwn, pub_mdwn)
if os.path.exists(draft_attch):
os.rename(draft_attch, pub_attch)