diff options
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 26 |
1 files changed, 23 insertions, 3 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 9f1815f38..6233738f6 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -42,9 +42,29 @@ function sandbox_lib_detect_find_program._do_check(program, opt) -- avoid gcc.exe signed by GIGA-BYTE if winos.file_signature and program:lower():endswith("gcc.exe") then - local signer = winos.file_signature(program) - if signer and signer.signer_name and signer.signer_name:startswith("GIGA-BYTE") then - return false + local check_signature = function (program) + if os.isfile(program) then + local signer = winos.file_signature(program) + if signer and signer.signer_name and signer.signer_name:startswith("GIGA-BYTE") then + return true + end + end + end + if path.is_absolute(program) then + if check_signature(program) then + return false + end + else + local paths = path.splitenv(vformat("$(env PATH)")) + for _, p in ipairs(paths) do + local prog = path.join(p, program) + if os.isfile(prog) then + if check_signature(prog) then + return false + end + break + end + end end end |
