diff options
author | Matthew Buckett <matthew.buckett@oucs.ox.ac.uk> | 2009-07-11 09:43:47 -0400 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2010-05-27 18:05:26 -0700 |
commit | 2daf66740bba0b2726462a547910d16cf0822db2 (patch) | |
tree | 45139dbc584bdbe297eaea71e6ff71822eaab751 | |
parent | f4f04d9fa8fda995974c9214eee42c3ea68b1125 (diff) | |
download | git-repo-2daf66740bba0b2726462a547910d16cf0822db2.tar.gz |
Allow files to be copied into new folders
Change-Id: I7f169e32be5a4328bb87ce7c2ff4b6529e925126
-rw-r--r-- | project.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -203,6 +203,10 @@ class _CopyFile: | |||
203 | # remove existing file first, since it might be read-only | 203 | # remove existing file first, since it might be read-only |
204 | if os.path.exists(dest): | 204 | if os.path.exists(dest): |
205 | os.remove(dest) | 205 | os.remove(dest) |
206 | else: | ||
207 | dir = os.path.dirname(dest) | ||
208 | if not os.path.isdir(dir): | ||
209 | os.makedirs(dir) | ||
206 | shutil.copy(src, dest) | 210 | shutil.copy(src, dest) |
207 | # make the file read-only | 211 | # make the file read-only |
208 | mode = os.stat(dest)[stat.ST_MODE] | 212 | mode = os.stat(dest)[stat.ST_MODE] |