summaryrefslogtreecommitdiff
path: root/xmake/core/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-12-08 22:23:20 +0800
committerruki <[email protected]>2017-12-08 08:20:01 +0800
commit43a7ef4eaa0a0347beee6f6cc4ef919b80e457cb (patch)
treec2c1754b0d7a65bff2ea82a43ac05515ae7e741f /xmake/core/main.lua
parent185daf2de0ac372ed78d61b69bf65d5a69687295 (diff)
improve to search root project directory
Diffstat (limited to 'xmake/core/main.lua')
-rw-r--r--xmake/core/main.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index 5e11acd28..6706b448d 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -192,7 +192,13 @@ function main._init()
-- update and enter project
xmake._PROJECT_DIR = path.directory(projectfile)
xmake._PROJECT_FILE = projectfile
- xmake._WORKING_DIR = os.cd(xmake._PROJECT_DIR)
+
+ -- enter the project directory
+ if os.isdir(os.projectdir()) then
+ xmake._WORKING_DIR = os.cd(os.projectdir())
+ else
+ xmake._WORKING_DIR = os.curdir()
+ end
-- add the directory of the program file (xmake) to $PATH environment
local programfile = os.programfile()