mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Allow files to be copied into new folders
Change-Id: I7f169e32be5a4328bb87ce7c2ff4b6529e925126
This commit is contained in:
parent
f4f04d9fa8
commit
2daf66740b
@ -203,6 +203,10 @@ class _CopyFile:
|
|||||||
# remove existing file first, since it might be read-only
|
# remove existing file first, since it might be read-only
|
||||||
if os.path.exists(dest):
|
if os.path.exists(dest):
|
||||||
os.remove(dest)
|
os.remove(dest)
|
||||||
|
else:
|
||||||
|
dir = os.path.dirname(dest)
|
||||||
|
if not os.path.isdir(dir):
|
||||||
|
os.makedirs(dir)
|
||||||
shutil.copy(src, dest)
|
shutil.copy(src, dest)
|
||||||
# make the file read-only
|
# make the file read-only
|
||||||
mode = os.stat(dest)[stat.ST_MODE]
|
mode = os.stat(dest)[stat.ST_MODE]
|
||||||
|
Loading…
Reference in New Issue
Block a user