summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/actions/require/action/install.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/xmake/actions/require/action/install.lua b/xmake/actions/require/action/install.lua
index 660256386..dd63e82ad 100644
--- a/xmake/actions/require/action/install.lua
+++ b/xmake/actions/require/action/install.lua
@@ -130,11 +130,11 @@ function main(package)
-- enter the working directory
local oldir = nil
if #package:urls() > 0 then
- for _, srcdir in ipairs(os.dirs(path.join(workdir, "source", "*"))) do
- oldir = os.cd(srcdir)
- break
- end
- if not oldir and os.isdir(path.join(workdir, "source")) then
+ -- only one root directory? skip it
+ local filedirs = os.filedirs(path.join(workdir, "source", "*"))
+ if #filedirs == 1 and os.isdir(filedirs[1]) then
+ oldir = os.cd(filedirs[1])
+ else
oldir = os.cd(path.join(workdir, "source"))
end
end