Fix "FileExistsError" when "platformio ci" command is used in pair with "--keep-build-dir" option

This commit is contained in:
Ivan Kravets
2019-03-14 20:12:18 +02:00
parent b3ac567b53
commit 0d904ad1cc
3 changed files with 38 additions and 3 deletions

View File

@@ -55,7 +55,6 @@ def validate_path(ctx, param, value): # pylint: disable=unused-argument
"--build-dir",
default=mkdtemp,
type=click.Path(
exists=True,
file_okay=False,
dir_okay=True,
writable=True,
@@ -134,7 +133,8 @@ def _copy_contents(dst_dir, contents):
if dst_dir_name == "src" and len(items['dirs']) == 1:
copytree(list(items['dirs']).pop(), dst_dir, symlinks=True)
else:
makedirs(dst_dir)
if not isdir(dst_dir):
makedirs(dst_dir)
for d in items['dirs']:
copytree(d, join(dst_dir, basename(d)), symlinks=True)