summaryrefslogtreecommitdiff
path: root/xmake/modules/utils/archive/archive.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-10 00:55:24 +0800
committerruki <[email protected]>2024-04-10 00:55:24 +0800
commit3270e053705de1df51abda4fa56faee6888d9295 (patch)
treee4b2c93fed2d900dc82bf5ec680c94ed40a87854 /xmake/modules/utils/archive/archive.lua
parent86075cdc1f9e82e65a94d35dd2725acbf590cd97 (diff)
improve archive
Diffstat (limited to 'xmake/modules/utils/archive/archive.lua')
-rw-r--r--xmake/modules/utils/archive/archive.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/xmake/modules/utils/archive/archive.lua b/xmake/modules/utils/archive/archive.lua
index d21203368..59933ae68 100644
--- a/xmake/modules/utils/archive/archive.lua
+++ b/xmake/modules/utils/archive/archive.lua
@@ -281,12 +281,25 @@ end
-- archive archive file using archivers
function _archive(archivefile, inputfiles, extension, archivers, opt)
+ local errors
for _, archive in ipairs(archivers) do
- if archive(archivefile, inputfiles, extension, opt) then
- return true
+ local ok = try {
+ function ()
+ return archive(archivefile, inputfiles, extension, opt)
+ end,
+ catch {
+ function (errs)
+ if errs then
+ errors = tostring(errs)
+ end
+ end
+ }
+ }
+ if ok then
+ return
end
end
- return false
+ raise("cannot archive %s, %s!", path.filename(archivefile), errors or "archivers not found!")
end
-- only archive tar file