From 2daf66740bba0b2726462a547910d16cf0822db2 Mon Sep 17 00:00:00 2001 From: Matthew Buckett Date: Sat, 11 Jul 2009 09:43:47 -0400 Subject: Allow files to be copied into new folders Change-Id: I7f169e32be5a4328bb87ce7c2ff4b6529e925126 --- project.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'project.py') diff --git a/project.py b/project.py index ff896d01..1bcd9596 100644 --- a/project.py +++ b/project.py @@ -203,6 +203,10 @@ class _CopyFile: # remove existing file first, since it might be read-only if os.path.exists(dest): os.remove(dest) + else: + dir = os.path.dirname(dest) + if not os.path.isdir(dir): + os.makedirs(dir) shutil.copy(src, dest) # make the file read-only mode = os.stat(dest)[stat.ST_MODE] -- cgit v1.2.3-54-g00ecf