BugID:24827808: Check and not allow to use aos sdk directory as project dir.
@@ -321,6 +321,19 @@ def cli(projectname, board, projectdir, templateapp):
if not projectdir:
projectdir = os.getcwd()
+ # not to use sdk dir as project dir
+ if os.path.abspath(projectdir).startswith(os.path.abspath(aos_sdk)):
+ errmsg = "It's not allowed to create project in AliOS Things "\
+ "SDK directory!\nPlease specify another directory "\
+ "via '-d' option."
+ try:
+ from aos.util import error
+ error(errmsg)
+ except Exception as e:
+ click.echo(errmsg)
+ finally:
+ return 1
+
destdir = os.path.join(projectdir, projectname)
destdir = os.path.abspath(destdir)
@@ -363,7 +376,5 @@ def cli(projectname, board, projectdir, templateapp):
gen_kconfig(destdir, projectname, board, True, True)
click.echo("[Info] Project Initialized at: %s" % destdir)
-
-
if __name__ == "__main__":
cli()
