Is it possible for Meson to read the contents of a file into an array or a string? From here a string can be split into an array, and an array can be looped over with foreach
, but I haven't been able to find a way to get the data from the file to start with.
Since Meson 0.57.0, you can use the read
function of the Filesystem module:
fs = import('fs')
...
my_list = fs.read('list.txt').strip().split('\n')
foreach item : my_list
# Do something
endforeach
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With