summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-22 23:50:51 +0800
committerruki <[email protected]>2020-04-22 17:05:10 +0800
commit00f34ec89f7735b45a3ecdb55f0952d545d73cbb (patch)
tree805b1ebb127cc86f94f1ecc6dd883294337ef00d /xmake/core/base
parent05df31effcfc9bc701387e1383b678f0914241be (diff)
pass engine name
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/global.lua7
-rw-r--r--xmake/core/base/os.lua3
-rw-r--r--xmake/core/base/xmake.lua5
3 files changed, 11 insertions, 4 deletions
diff --git a/xmake/core/base/global.lua b/xmake/core/base/global.lua
index b70e139fd..577eed0a9 100644
--- a/xmake/core/base/global.lua
+++ b/xmake/core/base/global.lua
@@ -88,23 +88,24 @@ end
-- get the configure file
function global.filepath()
- return path.join(global.directory(), "xmake.conf")
+ return path.join(global.directory(), xmake._NAME .. ".conf")
end
-- get the global configure directory
function global.directory()
if global._DIRECTORY == nil then
+ local name = "." .. xmake._NAME
local rootdir = os.getenv("XMAKE_GLOBALDIR")
if not rootdir then
-- compatible with the old `%appdata%/.xmake` directory if it exists
local appdata = (os.host() == "windows") and os.getenv("APPDATA")
- if appdata and os.isdir(path.join(appdata, ".xmake")) then
+ if appdata and os.isdir(path.join(appdata, name)) then
rootdir = appdata
else
rootdir = path.translate("~")
end
end
- global._DIRECTORY = path.join(rootdir, ".xmake")
+ global._DIRECTORY = path.join(rootdir, name)
end
return global._DIRECTORY
end
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index b6334a922..f4acb808c 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -555,7 +555,8 @@ function os.tmpdir(opt)
-- make sub-directory name
local subdir = os._TMPSUBDIR
if not subdir then
- subdir = path.join((os._FAKEROOT and ".xmakefake" or ".xmake") .. (os.uid().euid or ""), os.date("%y%m%d"))
+ local name = "." .. xmake._NAME
+ subdir = path.join((os._FAKEROOT and (name .. "fake") or name) .. (os.uid().euid or ""), os.date("%y%m%d"))
os._TMPSUBDIR = subdir
end
diff --git a/xmake/core/base/xmake.lua b/xmake/core/base/xmake.lua
index 973b66ace..e4db4851f 100644
--- a/xmake/core/base/xmake.lua
+++ b/xmake/core/base/xmake.lua
@@ -24,6 +24,11 @@ local xmake = xmake or {}
-- load modules
local semver = require("base/semver")
+-- get name
+function xmake.name()
+ return xmake._NAME or "xmake"
+end
+
-- get xmake version
function xmake.version()
if xmake._VERSION_CACHE == nil then