diff options
| author | ruki <[email protected]> | 2015-05-11 22:43:21 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-05-11 22:43:21 +0800 |
| commit | 3b93e699c16862a1c29c2047425ce3d8a4827ea7 (patch) | |
| tree | b83a3422f28efc68b2c66821681ddf117522986d /xmake/scripts/base/main.lua | |
| parent | f2313cc0c48b37b7aa6222457325a23ad62e1fd8 (diff) | |
save and load .config.lua
Diffstat (limited to 'xmake/scripts/base/main.lua')
| -rw-r--r-- | xmake/scripts/base/main.lua | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua index e9d3d2af9..eb1a57c3d 100644 --- a/xmake/scripts/base/main.lua +++ b/xmake/scripts/base/main.lua @@ -258,7 +258,7 @@ local menu = } -- done option -function main.done_option() +function main._done_option() -- the options local options = xmake._OPTIONS @@ -275,7 +275,21 @@ function main.done_option() assert(options.file) -- load and execute the xmake.lua script of the given project - dofile(options.file) + local script = loadfile(options.file) + if script then + -- execute it + local ok, err = pcall(script) + if not ok then + -- error + utils.error("load %s failed!", options.file) + utils.error(err) + return false + end + else + -- error + utils.error("%s not found!", options.file) + return false + end -- done help if options.help then @@ -316,7 +330,7 @@ function main.done() end -- done option - if not main.done_option() then + if not main._done_option() then return -1 end |
