diff options
| -rw-r--r-- | xmake/core/base/os.lua | 3 | ||||
| -rw-r--r-- | xmake/core/main.lua | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 94cde85e7..eb9ab6d31 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -637,6 +637,9 @@ end function os.cd(dir) assert(dir) + -- we can only change directory in main thread + assert(xmake.in_main_thread()) + -- support path instance dir = tostring(dir) diff --git a/xmake/core/main.lua b/xmake/core/main.lua index 3f0a4484f..cfde482fb 100644 --- a/xmake/core/main.lua +++ b/xmake/core/main.lua @@ -218,7 +218,7 @@ function main._init() xmake._PROJECT_FILE = projectfile -- enter the project directory - if os.isdir(os.projectdir()) then + if os.isdir(os.projectdir()) and xmake.in_main_thread() then os.cd(os.projectdir()) end else |
