summaryrefslogtreecommitdiff
path: root/xmake/scripts/base/global.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-04 09:01:53 +0800
committerruki <[email protected]>2015-06-04 09:01:53 +0800
commit282c12b8f7b9b01a85844326c28f6bc3529aa088 (patch)
tree2f7557c695789276022f8f8094ac17f3e90c2357 /xmake/scripts/base/global.lua
parenta73db10e9b42c8b18bf5b95d78855481beb67f20 (diff)
adjust global and config directory
Diffstat (limited to 'xmake/scripts/base/global.lua')
-rw-r--r--xmake/scripts/base/global.lua30
1 files changed, 16 insertions, 14 deletions
diff --git a/xmake/scripts/base/global.lua b/xmake/scripts/base/global.lua
index d1faff4b9..9e43213ee 100644
--- a/xmake/scripts/base/global.lua
+++ b/xmake/scripts/base/global.lua
@@ -130,7 +130,7 @@ end
function global._file()
-- get it
- return path.translate("~/.xmake/xmake.xconf")
+ return global.directory() .. "/xmake.xconf"
end
-- get the given configure from the current
@@ -164,6 +164,21 @@ function global.set(name, value)
end
+-- get the global configure directory
+function global.directory()
+
+ -- the directory
+ local dir = path.translate("~/.xmake")
+
+ -- create it directly first if not exists
+ if not os.isdir(dir) then
+ assert(os.mkdir(dir))
+ end
+
+ -- get it
+ return dir
+end
+
-- save xmake.xconf
function global.savexconf()
@@ -171,11 +186,6 @@ function global.savexconf()
local configs = global._CONFIGS
assert(configs)
- -- create directly first if not exists
- if not os.isdir("~/.xmake") then
- assert(os.mkdir("~/.xmake"))
- end
-
-- open the configure file
local path = global._file()
local file = io.open(path, "w")
@@ -285,13 +295,5 @@ function global.dump()
end
--- clean the current configure
-function global.clean()
-
- -- remove the configure file
- os.rm(global._file())
-
-end
-
-- return module: global
return global