diff options
| -rw-r--r-- | xmake/actions/create/main.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/create/xmake.lua | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/xmake/actions/create/main.lua b/xmake/actions/create/main.lua index 611c0a57c..560b3b457 100644 --- a/xmake/actions/create/main.lua +++ b/xmake/actions/create/main.lua @@ -76,13 +76,13 @@ function _create_project(language, templateid, targetname) end -- xmake.lua exists? - if os.isfile(path.join(projectdir, "xmake.lua")) then + if os.isfile(path.join(projectdir, "xmake.lua")) and not option.get("force") 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 + if not os.emptydir(projectdir) and not option.get("force") then -- otherwise, check whether it is empty raise("project directory (${underline}%s${reset}) is not empty!", projectdir) end diff --git a/xmake/actions/create/xmake.lua b/xmake/actions/create/xmake.lua index 005bdf6be..812411e03 100644 --- a/xmake/actions/create/xmake.lua +++ b/xmake/actions/create/xmake.lua @@ -38,7 +38,8 @@ task("create") -- options , options = { - {'l', "language", "kv", "c++", "The project language" + {'f', "force", "k", nil, "Force to create project in a non-empty directory."} + , {'l', "language", "kv", "c++", "The project language" -- show the description of all languages , values = function (complete, opt) |
