Replace deprecated leaf() with filename().
authorCarl Hetherington <cth@carlh.net>
Sat, 11 Nov 2023 00:31:58 +0000 (01:31 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 12 Nov 2023 21:11:27 +0000 (22:11 +0100)
16 files changed:
src/lib/content_factory.cc
src/lib/create_cli.cc
src/lib/film.cc
src/lib/image_filename_sorter.cc
src/lib/job.cc
src/lib/playlist.cc
src/lib/types.cc
src/lib/uploader.cc
src/lib/util.cc
src/wx/download_certificate_panel.cc
src/wx/file_picker_ctrl.cc
src/wx/fonts_dialog.cc
src/wx/system_font_dialog.cc
test/ffmpeg_dcp_test.cc
test/test.cc
test/threed_test.cc

index e1278c3b475d41f3711d69b81501d17a909990fc..dfa1ba55e4d4795ebdc66e23408390ec7c1b7814 100644 (file)
@@ -129,7 +129,7 @@ content_factory (boost::filesystem::path path)
 
                        LOG_GENERAL ("Checking file %1", i->path());
 
-                       if (boost::starts_with (i->path().leaf().string(), ".")) {
+                       if (boost::starts_with(i->path().filename().string(), ".")) {
                                /* We ignore hidden files */
                                LOG_GENERAL ("Ignored %1 (starts with .)", i->path());
                                continue;
index 6752be4094125f3d26dd7629f246b4215cec118b..1c2f2c6354fcf3ef4f2edf73096c9add9af39c22 100644 (file)
@@ -316,7 +316,7 @@ CreateCLI::CreateCLI (int argc, char* argv[])
        }
 
        if (_name.empty()) {
-               _name = content[0].path.leaf().string();
+               _name = content[0].path.filename().string();
        }
 
        if (_j2k_bandwidth && (*_j2k_bandwidth < 10000000 || *_j2k_bandwidth > Config::instance()->maximum_j2k_bandwidth())) {
index b4ad0d0f47f93ed319ed39c087a1bb703b826b9c..7ba245422a94329c0e54788d075101db2687f86c 100644 (file)
@@ -1303,7 +1303,7 @@ Film::cpls () const
        for (auto const& item: dcp::filesystem::directory_iterator(dir)) {
                if (
                        dcp::filesystem::is_directory(item) &&
-                       item.path().leaf() != "j2c" && item.path().leaf() != "video" && item.path().leaf() != "info" && item.path().leaf() != "analysis"
+                       item.path().filename() != "j2c" && item.path().filename() != "video" && item.path().filename() != "info" && item.path().filename() != "analysis"
                        ) {
 
                        try {
index ab0d298fc1bd0f9bcceb881a83744d9157681433..f0370bdcb5d120bde7a9b06aabb5ea4aad9b2caa 100644 (file)
@@ -54,7 +54,7 @@ string
 ImageFilenameSorter::extract_numbers (boost::filesystem::path p)
 {
        string numbers;
-       auto const ps = p.leaf().string();
+       auto const ps = p.filename().string();
        for (size_t i = 0; i < ps.size(); ++i) {
                if (isdigit (ps[i])) {
                        numbers += ps[i];
index 727456523ca39e7e58f1045fa4df1aea3095d291..28bdde7fc2dd9d34d52643356162d388e7ae35a5 100644 (file)
@@ -111,7 +111,7 @@ Job::run_wrapper ()
 
        } catch (dcp::FileError& e) {
 
-               string m = String::compose (_("An error occurred whilst handling the file %1."), boost::filesystem::path (e.filename()).leaf());
+               string m = String::compose(_("An error occurred whilst handling the file %1."), e.filename().filename());
 
                try {
                        auto const s = dcp::filesystem::space(e.filename());
index 7f8292c7fed3729e945f2314eb0eb2f601d4764d..85957e106803be886e4f5a85016f15cc21282282 100644 (file)
@@ -684,7 +684,7 @@ Playlist::content_summary (shared_ptr<const Film> film, DCPTimePeriod period) co
                }
 
                if (score > best_score) {
-                       best_summary = i->path(0).leaf().string();
+                       best_summary = i->path(0).filename().string();
                        best_score = score;
                }
        }
index a87c354f31faa2d99a81448cae96f2e05fdc63c6..58382fdc71312bc580c3dc611ffabf481dbeba6b 100644 (file)
@@ -45,7 +45,7 @@ using dcp::raw_convert;
 
 
 CPLSummary::CPLSummary (boost::filesystem::path p)
-       : dcp_directory (p.leaf().string())
+       : dcp_directory(p.filename().string())
 {
        dcp::DCP dcp (p);
 
index c5448e469b8c3175ab750496ae4672964cceeb08..f2a47f50ef5c49fa8e5151af02a989878e775563 100644 (file)
@@ -76,7 +76,7 @@ Uploader::upload_directory (boost::filesystem::path base, boost::filesystem::pat
                if (is_directory(i.path())) {
                        upload_directory (base, i.path(), transferred, total_size);
                } else {
-                       _set_status (String::compose(_("copying %1"), i.path().leaf()));
+                       _set_status(String::compose(_("copying %1"), i.path().filename()));
                        upload_file (i.path(), remove_prefix (base, i.path()), transferred, total_size);
                }
        }
index e0b5a294fe655dcb042a9014562ce8c26be4f114..71aee88fea6330f4187103bae99c7c88370cb652 100644 (file)
@@ -673,7 +673,7 @@ short_audio_channel_name (int c)
 bool
 valid_image_file (boost::filesystem::path f)
 {
-       if (boost::starts_with (f.leaf().string(), "._")) {
+       if (boost::starts_with(f.filename().string(), "._")) {
                return false;
        }
 
@@ -690,7 +690,7 @@ valid_image_file (boost::filesystem::path f)
 bool
 valid_sound_file (boost::filesystem::path f)
 {
-       if (boost::starts_with (f.leaf().string(), "._")) {
+       if (boost::starts_with(f.filename().string(), "._")) {
                return false;
        }
 
index b3de4ca2c427e16aa8981dd78ff13432073adae7..3f1509f60d912eb98832290854c5dbf212bbaec8 100644 (file)
@@ -74,7 +74,7 @@ optional<string>
 DownloadCertificatePanel::load_certificate_from_chain (boost::filesystem::path file, string url)
 {
        try {
-               _certificate = dcp::CertificateChain (dcp::file_to_string(file)).leaf();
+               _certificate = dcp::CertificateChain(dcp::file_to_string(file)).leaf();
                _url = url;
        } catch (dcp::MiscError& e) {
                return String::compose(wx_to_std(_("Could not read certificate file (%1)")), e.what());
index bf4877891a2344860c862f8d77599118e4341842..4bb6518efc2fe33a91ac26812a701a5fba9bd55e 100644 (file)
@@ -61,7 +61,7 @@ FilePickerCtrl::SetPath (wxString p)
        _path = p;
 
        if (!_path.IsEmpty ()) {
-               _file->SetLabel (std_to_wx (filesystem::path (wx_to_std (_path)).leaf().string()));
+               _file->SetLabel(std_to_wx(filesystem::path(wx_to_std(_path)).filename().string()));
        } else {
                _file->SetLabel (_("(None)"));
        }
index a035a5ffc53c981ad03910eec137158b6fce7caf..f2c9de5cb1c1cd673646678dd44327c59488c21b 100644 (file)
@@ -121,7 +121,7 @@ FontsDialog::setup ()
                _fonts->SetItem(n, 0, id);
                _fonts->SetItemData(n, i->id().empty());
                if (i->file()) {
-                       _fonts->SetItem(n, 1, i->file()->leaf().string());
+                       _fonts->SetItem(n, 1, i->file()->filename().string());
                }
                ++n;
        }
index 84285de12e35c6d0e6f09a4f5f0bff7dc3e10ed5..9814ededd07e70ebc4bab5d524c814201be18425 100644 (file)
@@ -62,7 +62,7 @@ SystemFontDialog::SystemFontDialog (wxWindow* parent)
 
        int n = 0;
        for (auto i: _fonts) {
-               _list->InsertItem (n++, std_to_wx (i.leaf().stem().string ()));
+               _list->InsertItem(n++, std_to_wx(i.filename().stem().string()));
        }
 
        auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
index c1c32294814a4f01576f5fc92fdcfaf80044756e..c332759c8f96c6dbab245fdc717d74370cef3c96 100644 (file)
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_have_dcp_test, * boost::unit_test::depends_on("ffmp
 
        p /= film->dcp_name();
        auto i = boost::filesystem::directory_iterator (p);
-       while (i != boost::filesystem::directory_iterator() && !boost::algorithm::starts_with (i->path().leaf().string(), "j2c")) {
+       while (i != boost::filesystem::directory_iterator() && !boost::algorithm::starts_with(i->path().filename().string(), "j2c")) {
                ++i;
        }
 
index 9b08dfb4e8619c8fe00cc70a16ae5e3b81fd69a6..2bd31292a562ffab3dd49522810935257c089e18 100644 (file)
@@ -843,7 +843,7 @@ dcp_file (shared_ptr<const Film> film, string prefix)
 
        vector<directory_entry> matches;
        std::copy_if(recursive_directory_iterator(film->dir(film->dcp_name())), recursive_directory_iterator(), std::back_inserter(matches), [&prefix](directory_entry const& entry) {
-               return boost::algorithm::starts_with(entry.path().leaf().string(), prefix);
+               return boost::algorithm::starts_with(entry.path().filename().string(), prefix);
        });
 
        BOOST_REQUIRE_MESSAGE(matches.size() == 1, "Found " << matches.size() << " files with prefix " << prefix);
@@ -854,7 +854,7 @@ boost::filesystem::path
 subtitle_file (shared_ptr<Film> film)
 {
        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_")) {
+               if (boost::algorithm::starts_with(i.path().filename().string(), "sub_")) {
                        return i.path();
                }
        }
index a53b4d10e3ce2c39a29818dbad4c1e8deab9cc53..698fcba0b50de8cf35f0b0392b01fc2d08104eaa 100644 (file)
@@ -319,7 +319,7 @@ BOOST_AUTO_TEST_CASE(threed_passthrough_test, * boost::unit_test::depends_on("th
 
        std::vector<directory_entry> matches;
        std::copy_if(recursive_directory_iterator(*input_dcp), recursive_directory_iterator(), std::back_inserter(matches), [](directory_entry const& entry) {
-               return boost::algorithm::starts_with(entry.path().leaf().string(), "j2c");
+               return boost::algorithm::starts_with(entry.path().filename().string(), "j2c");
        });
 
        BOOST_REQUIRE_EQUAL(matches.size(), 1U);