diff options
| author | ruki <[email protected]> | 2020-03-07 22:53:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-03-07 22:53:51 +0800 |
| commit | acca2c3115570e7f3b1ef059413c4dce49c520d1 (patch) | |
| tree | 2e4a74a2602284d2afb4c33e69e7739e1869d45a | |
| parent | 757ab49a3eb245163080dbc59f8f95f35ee47c9a (diff) | |
fix create project
| -rw-r--r-- | xmake/actions/create/main.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/xmake/actions/create/main.lua b/xmake/actions/create/main.lua index cb421acec..951981a1c 100644 --- a/xmake/actions/create/main.lua +++ b/xmake/actions/create/main.lua @@ -70,13 +70,21 @@ function _create_project(language, templateid, targetname) -- get project directory local projectdir = path.absolute(option.get("project") or path.join(os.curdir(), targetname)) - if not os.isdir(projectdir) then -- make the project directory if not exists os.mkdir(projectdir) - elseif not os.emptydir(projectdir) then + end + + -- xmake.lua exists? + if os.isfile(path.join(projectdir, "xmake.lua")) then + raise("project (${underline}%s/xmake.lua${reset}) exists!", projectdir) + end + + -- empty project? + os.tryrm(path.join(projectdir, ".xmake")) + if not os.emptydir(projectdir) then -- otherwise, check whether it is empty - raise("project directory (${underline}%s${reset}) is not empty!", path.relative(projectdir, os.workingdir())) + raise("project directory (${underline}%s${reset}) is not empty!", projectdir) end -- enter the project directory |
