Fix subtitle_file() to find both Interop and SMPTE subtitles.
authorCarl Hetherington <cth@carlh.net>
Tue, 20 Sep 2022 19:23:40 +0000 (21:23 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 20 Sep 2022 19:24:16 +0000 (21:24 +0200)
test/test.cc

index 9261ce43ba0e0515fa4e57dd3e29fc5ce28eb7f3..f1fd40fb791597c4bf5da7e960a05b523b5878cb 100644 (file)
@@ -836,13 +836,9 @@ dcp_file (shared_ptr<const Film> film, string prefix)
 boost::filesystem::path
 subtitle_file (shared_ptr<Film> film)
 {
-       for (auto i: boost::filesystem::directory_iterator(film->directory().get() / film->dcp_name (false))) {
-               if (boost::filesystem::is_directory(i.path())) {
-                       for (auto j: boost::filesystem::directory_iterator(i.path())) {
-                               if (boost::algorithm::starts_with(j.path().leaf().string(), "sub_")) {
-                                       return j.path();
-                               }
-                       }
+       for (auto i: boost::filesystem::recursive_directory_iterator(film->directory().get() / film->dcp_name(false))) {
+               if (boost::algorithm::starts_with(i.path().leaf().string(), "sub_")) {
+                       return i.path();
                }
        }