summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-23 10:40:50 +0800
committerruki <[email protected]>2016-05-23 10:40:50 +0800
commitc8454a31c38bbf25b56d0dd4a9a7c8d71ca59419 (patch)
tree126433106bc622ee8671f73aaf1fb5870c9427b9 /core/src
parent273e6abaea05b469bdb10b5cce57ff064886fe52 (diff)
impl run action
Diffstat (limited to 'core/src')
-rwxr-xr-xcore/src/xmake/machine.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c
index 5f499a963..3b11aef70 100755
--- a/core/src/xmake/machine.c
+++ b/core/src/xmake/machine.c
@@ -309,17 +309,21 @@ xm_machine_ref_t xm_machine_init()
#endif
lua_setglobal(impl->lua, "_NULDEV");
- // init version
+ // get version
tb_version_t const* version = xm_version();
- if (version)
- {
- tb_char_t version_cstr[256] = {0};
- tb_snprintf(version_cstr, sizeof(version_cstr), "XMake v%u.%u.%u.%llu", version->major, version->minor, version->alter, version->build);
- lua_pushstring(impl->lua, version_cstr);
- }
- else lua_pushstring(impl->lua, "XMake");
+ tb_assert_and_check_break(version);
+
+ // init version string
+ tb_char_t version_cstr[256] = {0};
+ tb_snprintf(version_cstr, sizeof(version_cstr), "XMake v%u.%u.%u.%llu", version->major, version->minor, version->alter, version->build);
+ lua_pushstring(impl->lua, version_cstr);
lua_setglobal(impl->lua, "_VERSION");
+ // init short version string
+ tb_snprintf(version_cstr, sizeof(version_cstr), "XMake v%u.%u.%u", version->major, version->minor, version->alter);
+ lua_pushstring(impl->lua, version_cstr);
+ lua_setglobal(impl->lua, "_VERSION_SHORT");
+
// init namespace: xmake
lua_newtable(impl->lua);
lua_setglobal(impl->lua, "xmake");