From 214b9fe1440a05e83c84d5b4f216d48ef99b35bf Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 16 Dec 2021 09:48:04 +0800 Subject: Update download.lua --- xmake/modules/private/action/require/impl/actions/download.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1