diff options
| author | ruki <[email protected]> | 2016-09-01 14:39:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-09-01 14:39:35 +0800 |
| commit | 698ba0673743e5d260882432b8ba1aff8193c2ed (patch) | |
| tree | 7759556242cbe27a5d7a2179d339ffa24735bb48 /xmake/core/base/interpreter.lua | |
| parent | 0783aa7d6de42ea14b2da12f1bfdcd0711fb7f99 (diff) | |
fix curdir bug for xmake.lua
Diffstat (limited to 'xmake/core/base/interpreter.lua')
| -rw-r--r-- | xmake/core/base/interpreter.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua index 8fb1d8afd..7b2cc9e2c 100644 --- a/xmake/core/base/interpreter.lua +++ b/xmake/core/base/interpreter.lua @@ -242,12 +242,21 @@ function interpreter:_api_builtin_add_subdirfiles(isdirs, ...) -- clear the current scope, force to enter root scope scopes._CURRENT = nil + -- save the current directory + local olddir = os.curdir() + + -- enter the script directory + os.cd(path.directory(file)) + -- done interpreter local ok, errors = xpcall(script, interpreter._traceback) if not ok then os.raise(errors) end + -- leave the script directory + os.cd(olddir) + -- restore the previous scope kind scopes._CURRENT_KIND = scope_kind_prev |
