diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-05-02 09:40:03 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-05-02 09:40:03 +0200 |
| commit | 01cfa8b85b93589476ce3dbff5f9f207ad737abf (patch) | |
| tree | 83dff85c4684c57ec8093ec0b73412870660cce7 /test/test.cc | |
| parent | 925d97b8e51421bf509c5ffbe4abe8f77a6ca95e (diff) | |
Add find_file from libdcp.
Diffstat (limited to 'test/test.cc')
| -rw-r--r-- | test/test.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test.cc b/test/test.cc index e61387132..21f27c36c 100644 --- a/test/test.cc +++ b/test/test.cc @@ -937,3 +937,17 @@ ConfigRestorer::~ConfigRestorer() setup_test_config(); } + +boost::filesystem::path +find_file (boost::filesystem::path dir, string filename_part) +{ + boost::optional<boost::filesystem::path> found; + for (auto i: boost::filesystem::directory_iterator(dir)) { + if (i.path().filename().string().find(filename_part) != string::npos) { + BOOST_REQUIRE (!found); + found = i; + } + } + BOOST_REQUIRE (found); + return *found; +} |
