build.lua: allow fail on rmdir, rm -rf to ignore nonexistent
This commit is contained in:
@@ -13,10 +13,10 @@ local function filename(path)
|
|||||||
return path:sub(s,e)
|
return path:sub(s,e)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function runCommand(cmd)
|
local function runCommand(cmd, ignore_fail)
|
||||||
print("> " .. cmd)
|
print("> " .. cmd)
|
||||||
local result = os.execute(cmd)
|
local result = os.execute(cmd)
|
||||||
if result ~= true then
|
if result ~= true and (not ignore_fail) then
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -33,9 +33,9 @@ end
|
|||||||
|
|
||||||
if arg[1] == "clean" then
|
if arg[1] == "clean" then
|
||||||
if separator == '\\' then
|
if separator == '\\' then
|
||||||
runCommand("rmdir /s /q build 2>nul")
|
runCommand("rmdir /s /q build 2>nul", true)
|
||||||
else
|
else
|
||||||
runCommand("rm -r build")
|
runCommand("rm -rf build")
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user