diff options
| -rw-r--r-- | xmake/core/base/global.lua | 5 | ||||
| -rw-r--r-- | xmake/core/base/os.lua | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/xmake/core/base/global.lua b/xmake/core/base/global.lua index f041c759d..9f8f5c08d 100644 --- a/xmake/core/base/global.lua +++ b/xmake/core/base/global.lua @@ -103,7 +103,10 @@ end -- get the global configure directory function global.directory() - return path.translate("~/.xmake") + if global._ROOTDIR == nil then + global._ROOTDIR = os.getenv("XMAKE_GLOBALDIR") or path.translate("~/.xmake") + end + return global._ROOTDIR end -- load the global configure diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 3a134f7ed..3ea8badc7 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -483,11 +483,17 @@ function os.tmpdir() end end + -- get root tmpdir + if os._ROOT_TMPDIR == nil then + os._ROOT_TMPDIR = os.getenv("XMAKE_TMPDIR") or os._tmpdir() + end + local tmpdir_root = os._ROOT_TMPDIR + -- make sub-directory name local subdir = (os._FAKEROOT and ".xmakefake" or ".xmake") .. (os.uid().euid or "") -- get a temporary directory for each user - local tmpdir = path.join(os._tmpdir(), subdir, os.date("%y%m%d")) + local tmpdir = path.join(tmpdir_root, subdir, os.date("%y%m%d")) -- ensure this directory exist and remove the previous directory if not os.isdir(tmpdir) then |
