检测系统内是否存在某个命令行程序 #3156
jingkaimori
started this conversation in
Ideas
Replies: 1 comment
-
import("lib.detect.find_tool")
local gcc = find_tool("gcc")
if gcc then
os.execv(gcc.program, {"--version"})
end or local ok = try {function () os.run("gcc --help") end}
if ok then
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
你在什么场景下需要该功能?
现有的
os.run
函数会通过命令行调用系统内的其他程序,现在检测不到系统路径上有没有指定的程序,因此直接运行命令可能会出错,需要容错。在Windows平台下,qt提供了windeploy这一命令行程序,这个程序会扫描编译好的binary文件,然后把该文件依赖的dll复制到合适的目录,以避免找不到dll的错误。
描述可能的解决方案
在os命名空间下添加新函数,对应的命令行程序满足以下条件时,该函数会返回
true
,否则返回false
--version
选项测试对应的程序描述你认为的候选方案
修改qt相关的规则,编译binary后调用Windows下的
windeploy
或macos下的macdeploy
,部署对应的动态链接库文件其他信息
No response
Beta Was this translation helpful? Give feedback.
All reactions