From 1aef7b0dcf8d8fa744f2a91e9711da39a78910e3 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 27 Sep 2018 22:37:34 +0800 Subject: improve to enter the source directory --- xmake/actions/require/action/install.lua | 10 +++++----- 1 file 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 -- cgit v1.3.1