summaryrefslogtreecommitdiff
path: root/xmake/core
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-23 22:41:05 +0800
committerruki <[email protected]>2020-04-23 10:06:32 +0800
commitd41e6aeb8aa516742895d64f36025db50e8f857f (patch)
tree6e791fa39be295ccfa59503a372a9a7e6f83c5e4 /xmake/core
parentceff124c76b8968b0009066c6fcf03a6f31fb180 (diff)
improve programdir
Diffstat (limited to 'xmake/core')
-rw-r--r--xmake/core/_xmake_main.lua2
-rw-r--r--xmake/core/main.lua4
2 files changed, 5 insertions, 1 deletions
diff --git a/xmake/core/_xmake_main.lua b/xmake/core/_xmake_main.lua
index 883e71f4c..cdb3cc1de 100644
--- a/xmake/core/_xmake_main.lua
+++ b/xmake/core/_xmake_main.lua
@@ -20,7 +20,7 @@
-- init namespace: xmake
xmake = xmake or {}
-xmake._NAME = _NAME
+xmake._NAME = _NAME or "xmake"
xmake._ARGV = _ARGV
xmake._HOST = _HOST
xmake._ARCH = _ARCH
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index 5da559fc1..11dd59ec8 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -179,6 +179,10 @@ function main._init()
if os.isdir(os.projectdir()) then
os.cd(os.projectdir())
end
+ else
+ -- patch a fake project file and directory for other lua programs with xmake/engine
+ xmake._PROJECT_DIR = path.join(os.tmpdir(), "local")
+ xmake._PROJECT_FILE = path.join(xmake._PROJECT_DIR, xmake._NAME .. ".lua")
end
-- add the directory of the program file (xmake) to $PATH environment