Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Meson read the contents of a file

Tags:

meson-build

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.

like image 366
Pentarctagon Avatar asked Nov 08 '17 08:11

Pentarctagon


1 Answers

Update

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
like image 90
ManuelAtWork Avatar answered Sep 29 '22 16:09

ManuelAtWork