fix: FileExistsError when specified project name conflicts with existed file

This commit is contained in:
debugtalk
2020-06-15 18:14:35 +08:00
parent b8b2e26b3e
commit 9ff3f943ab
2 changed files with 8 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
- fix: convert har to JSON format testcase
- fix: missing ${var} handling in overriding config variables
- fix: SyntaxError caused by quote in case of headers."Set-Cookie"
- fix: FileExistsError when specified project name conflicts with existed file
## 3.0.12 (2020-06-14)

View File

@@ -19,6 +19,7 @@ def init_parser_scaffold(subparsers):
def create_scaffold(project_name):
""" create scaffold with specified project name.
"""
def show_tree(prj_name):
try:
print(f"\n$ tree {prj_name} -a")
@@ -29,10 +30,15 @@ def create_scaffold(project_name):
if os.path.isdir(project_name):
logger.warning(
f"Project {project_name} exists, please specify a new project name."
f"Project folder {project_name} exists, please specify a new project name."
)
show_tree(project_name)
return 1
elif os.path.isfile(project_name):
logger.warning(
f"Project name {project_name} conflicts with existed file, please specify a new one."
)
return 1
logger.info(f"Create new project: {project_name}")
print(f"Project Root Dir: {os.path.join(os.getcwd(), project_name)}\n")