diff options
| author | ruki <[email protected]> | 2017-05-17 17:16:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-17 17:16:38 +0800 |
| commit | d0fe0eeb1c9385777b8319d6f92dbc907b917f84 (patch) | |
| tree | f45b25b968680b4a56ddab4f7dac62ff962cb4d5 | |
| parent | d8e138bc5ffc852e59d8040e735afb8927cf0429 (diff) | |
fix cache bug for finding program
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 14 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_programver.lua | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index f7d19d616..d2ee2a0c5 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -128,19 +128,19 @@ function sandbox_lib_detect_find_program.main(name, dirs, check) -- attempt to get result from cache first local cacheinfo = detectcache:get("find_program") or {} local result = cacheinfo[name] - if result then - return result + if result ~= nil then + return utils.ifelse(result, result, nil) end -- find executable program result = sandbox_lib_detect_find_program._find(name, dirs, check) -- cache result - if result then - cacheinfo[name] = result - detectcache:set("find_program", cacheinfo) - detectcache:flush() - end + cacheinfo[name] = utils.ifelse(result, result, false) + + -- save cache info + detectcache:set("find_program", cacheinfo) + detectcache:flush() -- trace if option.get("verbose") then diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua b/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua index 01ebeef4f..7da62a6c6 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua @@ -59,8 +59,8 @@ function sandbox_lib_detect_find_programver.main(program, command, parse) -- attempt to get result from cache first local cacheinfo = detectcache:get("find_programver") or {} local result = cacheinfo[program] - if result then - return result + if result ~= nil then + return utils.ifelse(result, result, nil) end -- attempt to get version output info @@ -80,11 +80,11 @@ function sandbox_lib_detect_find_programver.main(program, command, parse) end -- cache result - if result then - cacheinfo[program] = result - detectcache:set("find_program", cacheinfo) - detectcache:flush() - end + cacheinfo[program] = utils.ifelse(result, result, false) + + -- save cache info + detectcache:set("find_program", cacheinfo) + detectcache:flush() -- ok? return result |
