changeset 16:d6528dd74592

only create the directory if we need to
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 02 Aug 2011 18:03:55 -0700
parents d9026d114655
children 0a1aecef2c52
files document_it.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/document_it.py	Tue Aug 02 16:46:40 2011 -0700
+++ b/document_it.py	Tue Aug 02 18:03:55 2011 -0700
@@ -148,7 +148,10 @@
 
             # create a directory if needed
             dirname = os.path.dirname(dest)
-            os.makedirs(dirname)
+            if os.path.exists(dirname):
+                assert os.path.isdir(dirname)
+            else:
+                os.makedirs(dirname)
 
             # render
             f = file(dest, 'w')