summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/actions/create/main.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/xmake/actions/create/main.lua b/xmake/actions/create/main.lua
index 2eee8bbdf..162ee2b88 100644
--- a/xmake/actions/create/main.lua
+++ b/xmake/actions/create/main.lua
@@ -71,19 +71,17 @@ function _create_project(language, templateid, targetname)
-- get project directory
local projectdir = path.absolute(option.get("project") or path.join(os.curdir(), targetname))
- -- ensure the project directory
if not os.isdir(projectdir) then
+ -- make the project directory if not exists
os.mkdir(projectdir)
+ elseif 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()))
end
-- enter the project directory
os.cd(projectdir)
- -- ensure the project directory is empty
- if #os.filedirs('./*') ~= 0 then
- raise("project directory (${underline}%s${reset}) is not empty!", path.relative(projectdir, os.workingdir()))
- end
-
-- create project
local filedirs = {}
local sourcedir = path.join(tempinst:scriptdir(), "project")