diff options
| author | ruki <[email protected]> | 2018-04-22 00:31:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-04-22 00:31:31 +0800 |
| commit | 291020d00ec56964b62a89e19935a6c13b4baf26 (patch) | |
| tree | ac34ee2b61a71b7b4353cd269ad4956b0f50f0a5 | |
| parent | e189adce6d8d836e6b8aecf43f10f1cff3949c79 (diff) | |
detect qy sdk for windows
| -rw-r--r-- | core/src/xmake/winreg/query.c | 8 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_file.lua | 32 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_qt.lua | 18 |
3 files changed, 37 insertions, 21 deletions
diff --git a/core/src/xmake/winreg/query.c b/core/src/xmake/winreg/query.c index fd7f9cb5f..1e8ed513b 100644 --- a/core/src/xmake/winreg/query.c +++ b/core/src/xmake/winreg/query.c @@ -104,15 +104,9 @@ tb_int_t xm_winreg_query(lua_State* lua) valuename = p + 1; *p = '\0'; } - if (!valuename) - { - lua_pushnil(lua); - lua_pushfstring(lua, "parse value name failed: %s", path); - break; - } // trace - tb_trace_d("key: %s, subkey: %s, name: %s", pathkey, pathsubkey, valuename); + tb_trace_d("key: %s, subkey: %s, name: %s", pathkey, pathsubkey, valuename? valuename : "(default)"); // get registry key if (!tb_strcmp(pathkey, "HKEY_CLASSES_ROOT")) key = HKEY_CLASSES_ROOT; diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_file.lua b/xmake/core/sandbox/modules/import/lib/detect/find_file.lua index fc10db23b..f382b88a3 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_file.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_file.lua @@ -55,8 +55,24 @@ function sandbox_lib_detect_find_file.main(name, pathes, opt) -- init options opt = opt or {} - -- init pathes - pathes = table.wrap(pathes) + -- translate pathes + local pathes_translated = {} + for _, _path in ipairs(table.wrap(pathes)) do + + -- format path for builtin variables + if type(_path) == "function" then + local ok, results = sandbox.load(_path) + if ok then + _path = results or "" + else + raise(results) + end + else + _path = vformat(_path) + end + table.insert(pathes_translated, _path) + end + pathes = pathes_translated -- append suffixes to pathes local suffixes = table.wrap(opt.suffixes) @@ -74,18 +90,6 @@ function sandbox_lib_detect_find_file.main(name, pathes, opt) local result = nil for _, _path in ipairs(pathes) do - -- format path for builtin variables - if type(_path) == "function" then - local ok, results = sandbox.load(_path) - if ok then - _path = results or "" - else - raise(results) - end - else - _path = vformat(_path) - end - -- get file path local filepath = nil if os.isfile(_path) then diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua index 21c638eae..1becbdfc5 100644 --- a/xmake/modules/detect/sdks/find_qt.lua +++ b/xmake/modules/detect/sdks/find_qt.lua @@ -57,6 +57,24 @@ function _find_sdkdir(sdkdir, sdkver) table.insert(pathes, sdkdir) end if os.host() == "windows" then + local regs = + { + "HKEY_CLASSES_ROOT\\Applications\\QtProject.QtCreator.c\\shell\\Open\\Command", + "HKEY_CLASSES_ROOT\\Applications\\QtProject.QtCreator.cpp\\shell\\Open\\Command", + "HKEY_CURRENT_USER\\SOFTWARE\\Classes\\Applications\\QtProject.QtCreator.c\\shell\\Open\\Command", + "HKEY_CURRENT_USER\\SOFTWARE\\Classes\\Applications\\QtProject.QtCreator.cpp\\shell\\Open\\Command" + } + for _, reg in ipairs(regs) do + table.insert(pathes, function () + local value = val("reg " .. reg) + if value then + local p = value:find("\\Tools\\QtCreator", 1, true) + if p then + return path.translate(value:sub(1, p - 1)) + end + end + end) + end else table.insert(pathes, "~/Qt") end |
