diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-10-14 17:05:11 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-10-14 17:05:11 +0100 |
commit | 803e86f545bd62045a843e1f985c0a481fb23f68 (patch) | |
tree | 3633c6289e05882c48bf247b1125609223eba812 | |
parent | ad6e2bf2aa5fdc4b774db1c37e8298ec9658ba7e (diff) | |
download | jt-803e86f545bd62045a843e1f985c0a481fb23f68.tar.gz |
Create drafts and published dirs if missing
-rwxr-xr-x | jt | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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) |