summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-08-26 23:18:07 +0800
committerruki <[email protected]>2019-08-26 13:48:47 +0800
commit55e6f6992aa23a1ae1f5529aeb83021e40e4198b (patch)
treeb3f60b3ca8d923e31c93971b488150b8f090987b
parent28120ca72e81e66a029fd33cd19a0a8e81ef82a0 (diff)
improve config and global directory
-rw-r--r--xmake/core/base/global.lua7
-rw-r--r--xmake/core/project/cache.lua6
-rw-r--r--xmake/core/project/config.lua9
3 files changed, 9 insertions, 13 deletions
diff --git a/xmake/core/base/global.lua b/xmake/core/base/global.lua
index 5a4132b1f..1ec21315c 100644
--- a/xmake/core/base/global.lua
+++ b/xmake/core/base/global.lua
@@ -93,10 +93,11 @@ end
-- get the global configure directory
function global.directory()
- if global._ROOTDIR == nil then
- global._ROOTDIR = os.getenv("XMAKE_GLOBALDIR") or path.translate("~/.xmake")
+ if global._DIRECTORY == nil then
+ local rootdir = os.getenv("XMAKE_GLOBALDIR") or path.translate("~")
+ global._DIRECTORY = path.join(rootdir, ".xmake")
end
- return global._ROOTDIR
+ return global._DIRECTORY
end
-- load the global configuration
diff --git a/xmake/core/project/cache.lua b/xmake/core/project/cache.lua
index 4275fbeb8..9d72eaa3d 100644
--- a/xmake/core/project/cache.lua
+++ b/xmake/core/project/cache.lua
@@ -88,22 +88,16 @@ end
-- get the value
function cache:get(name)
-
- -- get it
return self._CACHEDATA[name]
end
-- set the value
function cache:set(name, value)
-
- -- set it
self._CACHEDATA[name] = value
end
-- clear all
function cache:clear()
-
- -- clear it
self._CACHEDATA = {__version = xmake._VERSION_SHORT}
end
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index 6c914de01..efb9867d0 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -145,12 +145,13 @@ function config.buildir()
return buildir
end
--- get the configure directory
+-- get the configure directory on the current host/arch platform
function config.directory()
- if config._ROOTDIR == nil then
- config._ROOTDIR = os.getenv("XMAKE_CONFIGDIR") or path.join(os.projectdir(), ".xmake", os.host(), os.arch())
+ if config._DIRECTORY == nil then
+ local rootdir = os.getenv("XMAKE_CONFIGDIR") or path.join(os.projectdir(), ".xmake")
+ config._DIRECTORY = path.join(rootdir, os.host(), os.arch())
end
- return config._ROOTDIR
+ return config._DIRECTORY
end
-- load the project configure