summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/private/action/clean/remove_files.lua10
-rw-r--r--xmake/modules/target/action/uninstall/unix.lua7
2 files changed, 8 insertions, 9 deletions
diff --git a/xmake/modules/private/action/clean/remove_files.lua b/xmake/modules/private/action/clean/remove_files.lua
index 3a679adcb..19a2dd01b 100644
--- a/xmake/modules/private/action/clean/remove_files.lua
+++ b/xmake/modules/private/action/clean/remove_files.lua
@@ -22,15 +22,11 @@
import("core.base.option")
-- remove the given files or (empty) directories
-function main(filedirs)
-
+function main(filedirs, opt)
+ opt or {}
for _, filedir in ipairs(filedirs) do
-
- -- remove it first
os.tryrm(filedir)
-
- -- remove all?
- if option.get("all") then
+ if option.get("all") or opt.emptydir then
-- remove it if the parent directory is empty
local parentdir = path.directory(filedir)
while parentdir and os.isdir(parentdir) and os.emptydir(parentdir) do
diff --git a/xmake/modules/target/action/uninstall/unix.lua b/xmake/modules/target/action/uninstall/unix.lua
index 7deeb53ef..1ad1d78ae 100644
--- a/xmake/modules/target/action/uninstall/unix.lua
+++ b/xmake/modules/target/action/uninstall/unix.lua
@@ -18,12 +18,15 @@
-- @file unix.lua
--
+-- imports
+import("private.action.clean.remove_files")
+
-- uninstall headers
function _uninstall_headers(target, opt)
local includedir = path.join(target:installdir(), opt and opt.includedir or "include")
local _, dstheaders = target:headerfiles(includedir, {installonly = true})
for _, dstheader in ipairs(dstheaders) do
- os.vrm(dstheader)
+ remove_files(dstheader, {emptydir = true})
end
end
@@ -44,7 +47,7 @@ function _uninstall_shared_for_package(target, pkg, outputdir)
end
end
end
- os.vrm(filepath)
+ remove_files(filepath, {emptydir = true})
end
end
end