summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-12-16 09:48:04 +0800
committerGitHub <[email protected]>2021-12-16 09:48:04 +0800
commit214b9fe1440a05e83c84d5b4f216d48ef99b35bf (patch)
tree6c6b1bacecf8875b1e46067609bc811803bb152f
parentc6ece064664fce0623c000227de67dc33b16d302 (diff)
Update download.lua
-rw-r--r--xmake/modules/private/action/require/impl/actions/download.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua
index 63e4c0d80..f2c8eeba7 100644
--- a/xmake/modules/private/action/require/impl/actions/download.lua
+++ b/xmake/modules/private/action/require/impl/actions/download.lua
@@ -151,15 +151,20 @@ function _download(package, url, sourcedir, url_alias, url_excludes)
-- extract package file
os.rm(sourcedir .. ".tmp")
+ local extension = archive.extension(packagefile)
if archive.extract(packagefile, sourcedir .. ".tmp", {excludes = url_excludes}) then
-- move to source directory
os.rm(sourcedir)
os.mv(sourcedir .. ".tmp", sourcedir)
- else
+ elseif extension and extension ~= "" then
-- create an empty source directory if do not extract package file
os.tryrm(sourcedir)
os.mkdir(sourcedir)
raise("cannot extract %s, maybe missing extractor or invalid package file!", packagefile)
+ else
+ -- if it is not archive file, we need only create empty source file and use package:originfile()
+ os.tryrm(sourcedir)
+ os.mkdir(sourcedir)
end
-- save original file path