summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2020-01-25 00:59:27 +0800
committerOpportunityLiu <[email protected]>2020-01-25 00:59:27 +0800
commit5d7a6efa13021da59a370bb011f4caf494b35da3 (patch)
treed7f6d9141d5fa2ab7ddcf5fddbe6d9922d7ee036
parent4689b1ab542c8dfbe255ac636e523818a3db9dde (diff)
fix check
-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")