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;
}
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())) {
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 {
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];
} 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());
}
if (score > best_score) {
- best_summary = i->path(0).leaf().string();
+ best_summary = i->path(0).filename().string();
best_score = score;
}
}
CPLSummary::CPLSummary (boost::filesystem::path p)
- : dcp_directory (p.leaf().string())
+ : dcp_directory(p.filename().string())
{
dcp::DCP dcp (p);
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);
}
}
bool
valid_image_file (boost::filesystem::path f)
{
- if (boost::starts_with (f.leaf().string(), "._")) {
+ if (boost::starts_with(f.filename().string(), "._")) {
return false;
}
bool
valid_sound_file (boost::filesystem::path f)
{
- if (boost::starts_with (f.leaf().string(), "._")) {
+ if (boost::starts_with(f.filename().string(), "._")) {
return false;
}
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());
_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)"));
}
_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;
}
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);
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;
}
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);
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();
}
}
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);