diff options
| author | Opportunity <[email protected]> | 2020-06-30 12:08:46 +0800 |
|---|---|---|
| committer | Opportunity <[email protected]> | 2020-06-30 12:08:46 +0800 |
| commit | 6dd3577da0219a388ea2b3331cb9956c1e915dcd (patch) | |
| tree | 5ea901dd29d0610f0fafe0f2c3bf6b85ff64dd4d /xmake/core/project/config.lua | |
| parent | 58c8e709cc4677ec6fb5fdfcec1958fab6743709 (diff) | |
set defaults for buildir
Diffstat (limited to 'xmake/core/project/config.lua')
| -rw-r--r-- | xmake/core/project/config.lua | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua index 837e45faf..90e4656a8 100644 --- a/xmake/core/project/config.lua +++ b/xmake/core/project/config.lua @@ -122,28 +122,27 @@ function config.options() return configs end --- get the buildir +-- get the buildir function config.buildir() - - -- get it - local buildir = config.get("buildir") - if buildir then - -- get the absolute path first - if not path.is_absolute(buildir) then - local rootdir - if os.isdir(path.join(os.workingdir(), ".xmake")) then - -- we switch to independent working directory @see https://github.com/xmake-io/xmake/issues/820 - rootdir = os.workingdir() - else - rootdir = os.projectdir() - end - buildir = path.absolute(buildir, rootdir) - end + -- get it + local buildir = config.get("buildir") or "build" - -- adjust path for the current directory - buildir = path.relative(buildir, os.curdir()) + -- get the absolute path first + if not path.is_absolute(buildir) then + local rootdir + if os.isdir(path.join(os.workingdir(), ".xmake")) then + -- we switch to independent working directory @see https://github.com/xmake-io/xmake/issues/820 + rootdir = os.workingdir() + else + rootdir = os.projectdir() + end + buildir = path.absolute(buildir, rootdir) end + + -- adjust path for the current directory + buildir = path.relative(buildir, os.curdir()) + return buildir end |
