Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In meson can you test for presence of a directory in your project?

Using meson build, is it possible to test for the existence of a directory in my project?

For example, I typically put acceptance tests next to my unit tests in a folder structure like this:

library/
        header.hp
        src/
            lib.cpp
        tests/
              acceptance_test/
              unit_test/ 

I don't always have acceptance tests, and I'd like to avoid having to have a meson.build file there if it isn't necessary. I'd much rather have a conditional subdir('acceptance_test') if the directory acceptance_test/ exists.

like image 973
paxos1977 Avatar asked Oct 21 '25 04:10

paxos1977


1 Answers

Update: Starting with Meson v0.53.0, you can use the Filesystem module:

fs = import('fs')
if fs.is_dir('<dirname>')
  message('directory exists')
endif

This is portable, and does not depend on a shell.

like image 56
ManuelAtWork Avatar answered Oct 26 '25 11:10

ManuelAtWork



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!