作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Meson 是否可以将文件内容读入数组或字符串?来自 here一个字符串可以拆分成一个数组,一个数组可以用foreach
循环遍历。 ,但我一直无法找到从文件中获取数据的方法。
最佳答案
要完成@TingPing 的回答,我通常会这样做:
files = run_command(
'cat', files('thefile.txt'),
).stdout().strip()
该方法也可以用于类似的事情:
images = run_command('find',
meson.current_source_dir(),
'-type', 'f',
'-name', '*.png',
'-printf', '%f\n'
).stdout().strip().split('\n')
不要忘记使用 Meson 的文件引用可能有点不精确,因此您需要使用其中之一:
files('thefilename')
join_paths(meson.source_root(), meson.current_source_dir(), 'thefilename')
cat
:
files = run_command('python', '-c',
'[print(line, end="") for line in open("{0}")]'.format(myfile)
).stdout().strip()
关于meson-build - 介子可以读取文件的内容吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47174801/
我尝试对介子进行单元测试,并且得到: ϰ ninja [4/4] Linking target test/crypto/crypto_tests. FAILED: test/crypto/crypt
我正在尝试编译 Pulse Effects项目,我在运行 meson build 后遇到了这个问题: Dependency gstreamer-1.0 found: NO (tried pkgconf
我的 Meson项目我有一个位于“不寻常”位置的依赖项: /opt/MyDependence/lib/libmyLib.so /opt/MyDependence/include/myLib.hpp 我
我是一名优秀的程序员,十分优秀!