summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-27 22:37:34 +0800
committerruki <[email protected]>2018-09-27 09:45:29 +0800
commit1aef7b0dcf8d8fa744f2a91e9711da39a78910e3 (patch)
tree92b269fb7983fcbe8108980ef875565a01642ef6
parent41917d1e75c3f7489c9888afceb1df73405e4ed5 (diff)
improve to enter the source directory
-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