anything that is passed to read_file() from libcxml.
This should fix #2623 and other similar problems.
#include "analytics.h"
#include "compose.hpp"
#include "exceptions.h"
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/warnings.h>
#include <libcxml/cxml.h>
try
{
cxml::Document f ("Analytics");
- f.read_file (read_path("analytics.xml"));
+ f.read_file(dcp::filesystem::fix_long_path(read_path("analytics.xml")));
_successful_dcp_encodes = f.number_child<int>("SuccessfulDCPEncodes");
} catch (...) {
/* Never mind */
AudioAnalysis::AudioAnalysis (boost::filesystem::path filename)
{
cxml::Document f ("AudioAnalysis");
- f.read_file (filename);
+ f.read_file(dcp::filesystem::fix_long_path(filename));
if (f.optional_number_child<int>("Version").get_value_or(1) < _current_state_version) {
/* Too old. Throw an exception so that this analysis is re-run. */
try
{
cxml::Document f ("Config");
- f.read_file (config_read_file());
+ f.read_file(dcp::filesystem::fix_long_path(config_read_file()));
auto version = f.optional_number_child<int> ("Version");
if (version && *version < _current_version) {
void
Config::read_cinemas()
{
- if (boost::filesystem::exists (_cinemas_file)) {
+ if (dcp::filesystem::exists(_cinemas_file)) {
try {
cxml::Document f("Cinemas");
- f.read_file(_cinemas_file);
+ f.read_file(dcp::filesystem::fix_long_path(_cinemas_file));
read_cinemas(f);
} catch (...) {
backup();
void
Config::read_dkdm_recipients()
{
- if (boost::filesystem::exists (_dkdm_recipients_file)) {
+ if (dcp::filesystem::exists(_dkdm_recipients_file)) {
try {
cxml::Document f("DKDMRecipients");
- f.read_file(_dkdm_recipients_file);
+ f.read_file(dcp::filesystem::fix_long_path(_dkdm_recipients_file));
read_dkdm_recipients(f);
} catch (...) {
backup();
}
f.checked_write(s.c_str(), s.bytes());
f.close();
- boost::filesystem::remove (target);
- boost::filesystem::rename (tmp, target);
+ dcp::filesystem::remove(target);
+ dcp::filesystem::rename(tmp, target);
} catch (xmlpp::exception& e) {
string s = e.what ();
trim (s);
try {
doc.write_to_file_formatted (file.string() + ".tmp");
- boost::filesystem::remove (file);
- boost::filesystem::rename (file.string() + ".tmp", file);
+ dcp::filesystem::remove(file);
+ dcp::filesystem::rename(file.string() + ".tmp", file);
} catch (xmlpp::exception& e) {
string s = e.what ();
trim (s);
}
boost::system::error_code ec;
- auto const e = boost::filesystem::exists (*dir, ec);
+ auto const e = dcp::filesystem::exists(*dir, ec);
if (ec || !e) {
return a;
}
h.clear ();
for (auto i: old) {
try {
- if (boost::filesystem::is_directory(i)) {
+ if (dcp::filesystem::is_directory(i)) {
h.push_back (i);
}
} catch (...) {
bool
Config::have_existing (string file)
{
- return boost::filesystem::exists (read_path(file));
+ return dcp::filesystem::exists(read_path(file));
}
_cinemas_file = file;
- if (boost::filesystem::exists (_cinemas_file)) {
+ if (dcp::filesystem::exists(_cinemas_file)) {
/* Existing file; read it in */
cxml::Document f ("Cinemas");
- f.read_file (_cinemas_file);
+ f.read_file(dcp::filesystem::fix_long_path(_cinemas_file));
read_cinemas (f);
}
list<string>
Config::templates () const
{
- if (!boost::filesystem::exists(read_path("templates"))) {
+ if (!dcp::filesystem::exists(read_path("templates"))) {
return {};
}
list<string> n;
- for (auto const& i: boost::filesystem::directory_iterator(read_path("templates"))) {
+ for (auto const& i: dcp::filesystem::directory_iterator(read_path("templates"))) {
n.push_back (i.path().filename().string());
}
return n;
bool
Config::existing_template (string name) const
{
- return boost::filesystem::exists (template_read_path(name));
+ return dcp::filesystem::exists(template_read_path(name));
}
void
Config::rename_template (string old_name, string new_name) const
{
- boost::filesystem::rename (template_read_path(old_name), template_write_path(new_name));
+ dcp::filesystem::rename(template_read_path(old_name), template_write_path(new_name));
}
void
Config::delete_template (string name) const
{
- boost::filesystem::remove (template_write_path(name));
+ dcp::filesystem::remove(template_write_path(name));
}
/** @return Path to the config.xml containing the actual settings, following a link if required */
config_file (boost::filesystem::path main)
{
cxml::Document f ("Config");
- if (!boost::filesystem::exists (main)) {
+ if (!dcp::filesystem::exists(main)) {
/* It doesn't exist, so there can't be any links; just return it */
return main;
}
/* See if there's a link */
try {
- f.read_file (main);
+ f.read_file(dcp::filesystem::fix_long_path(main));
auto link = f.optional_string_child("Link");
if (link) {
return *link;
Config::copy_and_link (boost::filesystem::path new_file) const
{
write ();
- boost::filesystem::copy_file (config_read_file(), new_file, boost::filesystem::copy_option::overwrite_if_exists);
+ dcp::filesystem::copy_file(config_read_file(), new_file, boost::filesystem::copy_option::overwrite_if_exists);
link (new_file);
}
auto config = Config::instance();
zipper.add ("config.xml", dcp::file_to_string(config->config_read_file()));
- if (boost::filesystem::exists(config->cinemas_file())) {
+ if (dcp::filesystem::exists(config->cinemas_file())) {
zipper.add ("cinemas.xml", dcp::file_to_string(config->cinemas_file()));
}
- if (boost::filesystem::exists(config->dkdm_recipients_file())) {
+ if (dcp::filesystem::exists(config->dkdm_recipients_file())) {
zipper.add ("dkdm_recipients.xml", dcp::file_to_string(config->dkdm_recipients_file()));
}
_last_write_times.push_back (*mod);
} else {
boost::system::error_code ec;
- auto last_write = boost::filesystem::last_write_time(i->content(), ec);
+ auto last_write = dcp::filesystem::last_write_time(i->content(), ec);
_last_write_times.push_back (ec ? 0 : last_write);
}
}
_last_write_times.clear ();
for (auto i: _paths) {
boost::system::error_code ec;
- auto last_write = boost::filesystem::last_write_time(i, ec);
+ auto last_write = dcp::filesystem::last_write_time(i, ec);
_last_write_times.push_back (ec ? 0 : last_write);
}
}
Content::paths_valid () const
{
for (auto i: _paths) {
- if (!boost::filesystem::exists (i)) {
+ if (!dcp::filesystem::exists(i)) {
return false;
}
}
_last_write_times.clear ();
for (auto i: _paths) {
boost::system::error_code ec;
- auto last_write = boost::filesystem::last_write_time(i, ec);
+ auto last_write = dcp::filesystem::last_write_time(i, ec);
_last_write_times.push_back (ec ? 0 : last_write);
}
}
boost::mutex::scoped_lock lm (_mutex);
_paths.push_back (p);
boost::system::error_code ec;
- auto last_write = boost::filesystem::last_write_time(p, ec);
+ auto last_write = dcp::filesystem::last_write_time(p, ec);
_last_write_times.push_back (ec ? 0 : last_write);
}
{
bool write_time_changed = false;
for (auto i = 0U; i < _paths.size(); ++i) {
- if (boost::filesystem::last_write_time(_paths[i]) != last_write_time(i)) {
+ if (dcp::filesystem::last_write_time(_paths[i]) != last_write_time(i)) {
write_time_changed = true;
break;
}
#include "log.h"
#include "compose.hpp"
#include <libcxml/cxml.h>
+#include <dcp/filesystem.h>
#include <dcp/smpte_subtitle_asset.h>
#include <boost/algorithm/string.hpp>
{
vector<shared_ptr<Content>> content;
- if (boost::filesystem::is_directory (path)) {
+ if (dcp::filesystem::is_directory(path)) {
LOG_GENERAL ("Look in directory %1", path);
- if (boost::filesystem::is_empty (path)) {
+ if (dcp::filesystem::is_empty(path)) {
return content;
}
int image_files = 0;
int sound_files = 0;
int read = 0;
- for (boost::filesystem::directory_iterator i(path); i != boost::filesystem::directory_iterator() && read < 10; ++i) {
+ for (dcp::filesystem::directory_iterator i(path); i != dcp::filesystem::directory_iterator() && read < 10; ++i) {
LOG_GENERAL ("Checking file %1", i->path());
continue;
}
- if (!boost::filesystem::is_regular_file(i->path())) {
+ if (!dcp::filesystem::is_regular_file(i->path())) {
/* Ignore things which aren't files (probably directories) */
LOG_GENERAL ("Ignored %1 (not a regular file)", i->path());
continue;
if (image_files > 0 && sound_files == 0) {
content.push_back (make_shared<ImageContent>(path));
} else if (image_files == 0 && sound_files > 0) {
- for (auto i: boost::filesystem::directory_iterator(path)) {
+ for (auto i: dcp::filesystem::directory_iterator(path)) {
content.push_back (make_shared<FFmpegContent>(i.path()));
}
}
single = make_shared<StringTextFileContent>(path);
} else if (ext == ".xml") {
cxml::Document doc;
- doc.read_file (path);
+ doc.read_file(dcp::filesystem::fix_long_path(path));
if (doc.root_name() == "DCinemaSecurityMessage") {
throw KDMAsContentError ();
}
#include "dcpomatic_log.h"
#include "exceptions.h"
#include "log.h"
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/warnings.h>
#include <glib.h>
if (auto appdir = getenv("APPDIR")) {
return boost::filesystem::path(appdir) / "usr" / "share" / "libdcp";
}
- return boost::filesystem::canonical(LINUX_SHARE_PREFIX) / "libdcp";
+ return dcp::filesystem::canonical(LINUX_SHARE_PREFIX) / "libdcp";
}
openssl_path ()
{
auto p = directory_containing_executable() / "dcpomatic2_openssl";
- if (boost::filesystem::is_regular_file(p)) {
+ if (dcp::filesystem::is_regular_file(p)) {
return p;
}
for (int i = 0; i < files; ++i) {
boost::filesystem::path filename = _output;
- string extension = boost::filesystem::extension (filename);
- filename = boost::filesystem::change_extension (filename, "");
+ auto extension = dcp::filesystem::extension(filename);
+ filename = dcp::filesystem::change_extension(filename, "");
if (files > 1) {
/// TRANSLATORS: _reel%1 here is to be added to an export filename to indicate
#include "dcpomatic_assert.h"
#include "exceptions.h"
#include "file_group.h"
+#include <dcp/filesystem.h>
#include <sndfile.h>
#include <cstdio>
if (!_current_file) {
throw OpenFileError (_paths[_current_path], errno, OpenFileError::READ);
}
- _current_size = boost::filesystem::file_size (_paths[_current_path]);
+ _current_size = dcp::filesystem::file_size(_paths[_current_path]);
}
size_t i = 0;
int64_t sub_pos = _position;
while (i < _paths.size()) {
- boost::uintmax_t len = boost::filesystem::file_size (_paths[i]);
+ boost::uintmax_t len = dcp::filesystem::file_size(_paths[i]);
if (sub_pos < int64_t(len)) {
break;
}
{
int64_t len = 0;
for (size_t i = 0; i < _paths.size(); ++i) {
- len += boost::filesystem::file_size (_paths[i]);
+ len += dcp::filesystem::file_size(_paths[i]);
}
return len;
#include "cross.h"
#include "config.h"
#include <dcp/file.h>
+#include <dcp/filesystem.h>
#include <cstdio>
#include <iostream>
#include <cerrno>
uintmax_t head_amount = amount;
uintmax_t tail_amount = amount;
boost::system::error_code ec;
- uintmax_t size = boost::filesystem::file_size (_file, ec);
+ uintmax_t size = dcp::filesystem::file_size(_file, ec);
if (size == static_cast<uintmax_t>(-1)) {
return "";
}
#include <dcp/certificate_chain.h>
#include <dcp/cpl.h>
#include <dcp/decrypted_kdm.h>
+#include <dcp/filesystem.h>
#include <dcp/local_time.h>
#include <dcp/raw_convert.h>
#include <dcp/reel_asset.h>
_playlist_length_change_connection = _playlist->LengthChange.connect (bind(&Film::playlist_length_change, this));
if (dir) {
- /* Make state.directory a complete path without ..s (where possible)
- (Code swiped from Adam Bowen on stackoverflow)
- XXX: couldn't/shouldn't this just be boost::filesystem::canonical?
- */
-
- boost::filesystem::path p (boost::filesystem::system_complete (dir.get()));
- boost::filesystem::path result;
- for (auto i: p) {
- if (i == "..") {
- boost::system::error_code ec;
- if (boost::filesystem::is_symlink(result, ec) || result.filename() == "..") {
- result /= i;
- } else {
- result = result.parent_path ();
- }
- } else if (i != ".") {
- result /= i;
- }
- }
-
- set_directory (result.make_preferred ());
+ set_directory(dcp::filesystem::weakly_canonical(*dir));
}
if (_directory) {
Film::write_metadata ()
{
DCPOMATIC_ASSERT (directory());
- boost::filesystem::create_directories (directory().get());
+ dcp::filesystem::create_directories(directory().get());
auto const filename = file(metadata_file);
try {
metadata()->write_to_file_formatted(filename.string());
void
Film::write_template (boost::filesystem::path path) const
{
- boost::filesystem::create_directories (path.parent_path());
+ dcp::filesystem::create_directories(path.parent_path());
shared_ptr<xmlpp::Document> doc = metadata (false);
metadata(false)->write_to_file_formatted(path.string());
}
Film::read_metadata (optional<boost::filesystem::path> path)
{
if (!path) {
- if (boost::filesystem::exists (file ("metadata")) && !boost::filesystem::exists (file (metadata_file))) {
+ if (dcp::filesystem::exists(file("metadata")) && !dcp::filesystem::exists(file(metadata_file))) {
throw runtime_error (_("This film was created with an older version of DCP-o-matic, and unfortunately it cannot be loaded into this version. You will need to create a new Film, re-add your content and set it up again. Sorry!"));
}
path = file (metadata_file);
}
- if (!boost::filesystem::exists(*path)) {
+ if (!dcp::filesystem::exists(*path)) {
throw FileNotFoundError(*path);
}
cxml::Document f ("Metadata");
- f.read_file (path.get ());
+ f.read_file(dcp::filesystem::fix_long_path(path.get()));
_state_version = f.number_child<int> ("Version");
if (_state_version > current_state_version) {
} else if (_state_version < current_state_version) {
/* This is an older version; save a copy (if we haven't already) */
auto const older = path->parent_path() / String::compose("metadata.%1.xml", _state_version);
- if (!boost::filesystem::is_regular_file(older)) {
+ if (!dcp::filesystem::is_regular_file(older)) {
try {
- boost::filesystem::copy_file(*path, older);
+ dcp::filesystem::copy_file(*path, older);
} catch (...) {
/* Never mind; at least we tried */
}
p /= d;
if (create) {
- boost::filesystem::create_directories (p);
+ dcp::filesystem::create_directories(p);
}
return p;
p /= _directory.get();
p /= f;
- boost::filesystem::create_directories (p.parent_path ());
+ dcp::filesystem::create_directories(p.parent_path());
return p;
}
vector<CPLSummary> out;
auto const dir = directory().get();
- for (auto const& item: boost::filesystem::directory_iterator(dir)) {
+ for (auto const& item: dcp::filesystem::directory_iterator(dir)) {
if (
- boost::filesystem::is_directory(item) &&
+ dcp::filesystem::is_directory(item) &&
item.path().leaf() != "j2c" && item.path().leaf() != "video" && item.path().leaf() != "info" && item.path().leaf() != "analysis"
) {
if (f) {
f.close();
boost::system::error_code ec;
- boost::filesystem::create_hard_link (test, test2, ec);
+ dcp::filesystem::create_hard_link(test, test2, ec);
if (ec) {
can_hard_link = false;
}
- boost::filesystem::remove (test);
- boost::filesystem::remove (test2);
+ dcp::filesystem::remove(test);
+ dcp::filesystem::remove(test2);
}
- auto s = boost::filesystem::space (internal_video_asset_dir ());
+ auto s = dcp::filesystem::space(internal_video_asset_dir());
required = double (required_disk_space ()) / 1073741824.0f;
if (!can_hard_link) {
required *= 2;
InfoFileHandle::InfoFileHandle (boost::mutex& mutex, boost::filesystem::path path, bool read)
: _lock (mutex)
- , _file (path, read ? "rb" : (boost::filesystem::exists(path) ? "r+b" : "wb"))
+ , _file(path, read ? "rb" : (dcp::filesystem::exists(path) ? "r+b" : "wb"))
{
if (!_file) {
- throw OpenFileError (path, errno, read ? OpenFileError::READ : (boost::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE));
+ throw OpenFileError(path, errno, read ? OpenFileError::READ : (dcp::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE));
}
}
#include "content.h"
#include "find_missing.h"
#include "util.h"
-#include <boost/filesystem.hpp>
+#include <dcp/filesystem.h>
using std::map;
search (Replacements& replacement_paths, boost::filesystem::path directory, int depth = 0)
{
boost::system::error_code ec;
- for (auto candidate: boost::filesystem::directory_iterator(directory, ec)) {
- if (boost::filesystem::is_regular_file(candidate.path())) {
+ for (auto candidate: dcp::filesystem::directory_iterator(directory, ec)) {
+ if (dcp::filesystem::is_regular_file(candidate.path())) {
for (auto& replacement: replacement_paths) {
for (auto& path: replacement.second) {
- if (!boost::filesystem::exists(path) && path.filename() == candidate.path().filename()) {
+ if (!dcp::filesystem::exists(path) && path.filename() == candidate.path().filename()) {
path = candidate.path();
}
}
}
- } else if (boost::filesystem::is_directory(candidate.path()) && depth <= 2) {
+ } else if (dcp::filesystem::is_directory(candidate.path()) && depth <= 2) {
search (replacement_paths, candidate, depth + 1);
}
}
#include "font.h"
#include "font_config.h"
#include "util.h"
+#include <dcp/filesystem.h>
#include <fontconfig/fontconfig.h>
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
{
for (auto file: _temp_files) {
boost::system::error_code ec;
- boost::filesystem::remove(file, ec);
+ dcp::filesystem::remove(file, ec);
}
}
#include "video_content.h"
#include "writer.h"
#include <dcp/cpl.h>
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/reel.h>
#include <dcp/reel_closed_caption_asset.h>
for (auto j: i->text) {
for (auto k: j->fonts()) {
auto const p = k->file ();
- if (p && boost::filesystem::file_size(p.get()) >= (MAX_FONT_FILE_SIZE - SIZE_SLACK)) {
+ if (p && dcp::filesystem::file_size(p.get()) >= (MAX_FONT_FILE_SIZE - SIZE_SLACK)) {
big_font_files = true;
}
}
Hints::check_loudness ()
{
auto path = film()->audio_analysis_path(film()->playlist());
- if (!boost::filesystem::exists(path)) {
+ if (!dcp::filesystem::exists(path)) {
return false;
}
bool
subtitle_mxf_too_big (shared_ptr<dcp::SubtitleAsset> asset)
{
- return asset && asset->file() && boost::filesystem::file_size(*asset->file()) >= (MAX_TEXT_MXF_SIZE - SIZE_SLACK);
+ return asset && asset->file() && dcp::filesystem::file_size(*asset->file()) >= (MAX_TEXT_MXF_SIZE - SIZE_SLACK);
}
bool subs_mxf_too_big = false;
auto dcp_dir = film->dir("hints") / dcpomatic::get_process_id();
- boost::filesystem::remove_all (dcp_dir);
+ dcp::filesystem::remove_all(dcp_dir);
_writer->finish (film->dir("hints") / dcpomatic::get_process_id());
subs_mxf_too_big = true;
}
}
- boost::filesystem::remove_all (dcp_dir);
+ dcp::filesystem::remove_all(dcp_dir);
emit (bind(boost::ref(Finished)));
}
#include "util.h"
#include "video_content.h"
#include <libcxml/cxml.h>
+#include <dcp/filesystem.h>
#include <libxml++/libxml++.h>
#include <iostream>
{
video = make_shared<VideoContent>(this);
- if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) {
+ if (dcp::filesystem::is_regular_file(p) && valid_image_file(p)) {
add_path (p);
} else {
_path_to_scan = p;
job->sub (_("Scanning image files"));
vector<boost::filesystem::path> paths;
int n = 0;
- for (auto i: boost::filesystem::directory_iterator(*_path_to_scan)) {
- if (boost::filesystem::is_regular_file(i.path()) && valid_image_file (i.path())) {
+ for (auto i: dcp::filesystem::directory_iterator(*_path_to_scan)) {
+ if (dcp::filesystem::is_regular_file(i.path()) && valid_image_file(i.path())) {
paths.push_back (i.path());
}
++n;
#include "job.h"
#include <dcp/openjpeg_image.h>
#include <dcp/exceptions.h>
+#include <dcp/filesystem.h>
#include <dcp/j2k_transcode.h>
#include <iostream>
{
auto path = content->path(0);
if (valid_j2k_file (path)) {
- auto size = boost::filesystem::file_size (path);
+ auto size = dcp::filesystem::file_size(path);
dcp::File f(path, "rb");
if (!f) {
throw FileError ("Could not open file for reading", path);
string m = String::compose (_("An error occurred whilst handling the file %1."), boost::filesystem::path (e.filename()).leaf());
try {
- auto const s = boost::filesystem::space (e.filename());
+ auto const s = dcp::filesystem::space(e.filename());
if (s.available < pow (1024, 3)) {
m += N_("\n\n");
m += _("The drive that the film is stored on is low in disc space. Free some more space and try again.");
String::compose (_("Could not open %1"), e.file().string()),
String::compose (
_("DCP-o-matic could not open the file %1 (%2). Perhaps it does not exist or is in an unexpected format."),
- boost::filesystem::absolute (e.file()).string(),
+ dcp::filesystem::absolute(e.file()).string(),
e.what()
)
);
String::compose (_("Could not open %1"), e.path1().string ()),
String::compose (
_("DCP-o-matic could not open the file %1 (%2). Perhaps it does not exist or is in an unexpected format."),
- boost::filesystem::absolute (e.path1()).string(),
+ dcp::filesystem::absolute(e.path1()).string(),
e.what()
)
);
#include <dcp/certificate.h>
#include <dcp/decrypted_kdm.h>
#include <dcp/encrypted_kdm.h>
+#include <dcp/filesystem.h>
#include <getopt.h>
kdm_cli (int argc, char* argv[], std::function<void (string)> out)
try
{
- boost::filesystem::path output = boost::filesystem::current_path();
+ boost::filesystem::path output = dcp::filesystem::current_path();
auto container_name_format = Config::instance()->kdm_container_name_format();
auto filename_format = Config::instance()->kdm_filename_format();
optional<string> cinema_name;
}
string const thing = argv[optind];
- if (boost::filesystem::is_directory(thing) && boost::filesystem::is_regular_file(boost::filesystem::path(thing) / "metadata.xml")) {
+ if (dcp::filesystem::is_directory(thing) && dcp::filesystem::is_regular_file(boost::filesystem::path(thing) / "metadata.xml")) {
from_film (
screens,
thing,
out
);
} else {
- if (boost::filesystem::is_regular_file(thing)) {
+ if (dcp::filesystem::is_regular_file(thing)) {
dkdm = dcp::EncryptedKDM (dcp::file_to_string (thing));
} else {
dkdm = find_dkdm (thing);
#include "util.h"
#include "zipper.h"
#include <dcp/file.h>
+#include <dcp/filesystem.h>
#include "i18n.h"
return written;
}
- if (!boost::filesystem::exists (directory)) {
- boost::filesystem::create_directories (directory);
+ if (!dcp::filesystem::exists(directory)) {
+ dcp::filesystem::create_directories(directory);
}
/* Write KDMs to the specified directory */
for (auto i: kdms) {
- auto out = dcp::fix_long_path(directory / careful_string_filter(name_format.get(i->name_values(), ".xml")));
- if (!boost::filesystem::exists (out) || confirm_overwrite (out)) {
+ auto out = directory / careful_string_filter(name_format.get(i->name_values(), ".xml"));
+ if (!dcp::filesystem::exists(out) || confirm_overwrite(out)) {
i->kdm_as_xml (out);
++written;
}
for (auto const& kdm: kdms) {
auto path = directory;
path /= container_name_format.get(kdm.front()->name_values(), "", "s");
- if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
- boost::filesystem::create_directories (path);
+ if (!dcp::filesystem::exists(path) || confirm_overwrite(path)) {
+ dcp::filesystem::create_directories(path);
write_files(kdm, path, filename_format, confirm_overwrite);
written += kdm.size();
}
for (auto const& kdm: kdms) {
auto path = directory;
path /= container_name_format.get(kdm.front()->name_values(), ".zip", "s");
- if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
- if (boost::filesystem::exists (path)) {
+ if (!dcp::filesystem::exists(path) || confirm_overwrite(path)) {
+ if (dcp::filesystem::exists(path)) {
/* Creating a new zip file over an existing one is an error */
- boost::filesystem::remove (path);
+ dcp::filesystem::remove(path);
}
make_zip_file(kdm, path, filename_format);
written += kdm.size();
auto first = kdms_for_cinema.front();
auto zip_file = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
- boost::filesystem::create_directories (zip_file);
+ dcp::filesystem::create_directories(zip_file);
zip_file /= container_name_format.get(first->name_values(), ".zip");
make_zip_file (kdms_for_cinema, zip_file, filename_format);
try {
email.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
} catch (...) {
- boost::filesystem::remove (zip_file);
+ dcp::filesystem::remove(zip_file);
log_details (email);
throw;
}
log_details (email);
- boost::filesystem::remove (zip_file);
+ dcp::filesystem::remove(zip_file);
}
}
#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/interop_subtitle_asset.h>
+#include <dcp/filesystem.h>
#include <dcp/font_asset.h>
#include <dcp/mono_picture_asset.h>
#include <dcp/reel.h>
return string{"Missing -o or --output"};
}
- if (boost::filesystem::exists(*output_dir)) {
+ if (dcp::filesystem::exists(*output_dir)) {
return String::compose("Output directory %1 already exists.", *output_dir);
}
}
boost::system::error_code ec;
- boost::filesystem::create_directory(*output_dir, ec);
+ dcp::filesystem::create_directory(*output_dir, ec);
if (ec) {
return String::compose("Could not create output directory %1: %2", *output_dir, ec.message());
}
}
if (rename) {
- output_path /= String::compose("%1%2", (*iter)->id(), boost::filesystem::extension((*iter)->file().get()));
+ output_path /= String::compose("%1%2", (*iter)->id(), dcp::filesystem::extension((*iter)->file().get()));
(*iter)->rename_file(output_path);
} else {
output_path /= (*iter)->file()->filename();
}
- boost::filesystem::create_directories(output_path.parent_path());
+ dcp::filesystem::create_directories(output_path.parent_path());
boost::system::error_code ec;
if (hard_link) {
- boost::filesystem::create_hard_link(input_path, output_path, ec);
+ dcp::filesystem::create_hard_link(input_path, output_path, ec);
if (ec) {
throw CopyError(String::compose("Could not hard-link asset %1: %2", input_path.string(), ec.message()));
}
} else if (soft_link) {
- boost::filesystem::create_symlink(input_path, output_path, ec);
+ dcp::filesystem::create_symlink(input_path, output_path, ec);
if (ec) {
throw CopyError(String::compose("Could not soft-link asset %1: %2", input_path.string(), ec.message()));
}
} else {
- boost::filesystem::copy_file(input_path, output_path, ec);
+ dcp::filesystem::copy_file(input_path, output_path, ec);
if (ec) {
throw CopyError(String::compose("Could not copy asset %1: %2", input_path.string(), ec.message()));
}
already_copied.push_back(asset_id);
} else {
boost::system::error_code ec;
- boost::filesystem::remove_all(*output_dir, ec);
+ dcp::filesystem::remove_all(*output_dir, ec);
throw CopyError(String::compose("Could not find required asset %1", asset_id));
}
};
#include <dcp/certificate_chain.h>
#include <dcp/cpl.h>
#include <dcp/dcp.h>
+#include <dcp/filesystem.h>
#include <dcp/interop_subtitle_asset.h>
#include <dcp/mono_picture_asset.h>
#include <dcp/raw_convert.h>
to change its contents (if only by changing the IDs); see
#1126.
*/
- if (boost::filesystem::exists(asset) && boost::filesystem::hard_link_count(asset) > 1) {
+ if (dcp::filesystem::exists(asset) && dcp::filesystem::hard_link_count(asset) > 1) {
if (job) {
job->sub (_("Copying old video file"));
copy_in_bits (asset, asset.string() + ".tmp", bind(&Job::set_progress, job.get(), _1, false));
} else {
- boost::filesystem::copy_file (asset, asset.string() + ".tmp");
+ dcp::filesystem::copy_file(asset, asset.string() + ".tmp");
}
- boost::filesystem::remove (asset);
- boost::filesystem::rename (asset.string() + ".tmp", asset);
+ dcp::filesystem::remove(asset);
+ dcp::filesystem::rename(asset.string() + ".tmp", asset);
}
}
/* Offset of the last dcp::FrameInfo in the info file */
- int const n = (boost::filesystem::file_size(info_file->get().path()) / _info_size) - 1;
- LOG_GENERAL ("The last FI is %1; info file is %2, info size %3", n, boost::filesystem::file_size(info_file->get().path()), _info_size);
+ int const n = (dcp::filesystem::file_size(info_file->get().path()) / _info_size) - 1;
+ LOG_GENERAL ("The last FI is %1; info file is %2, info size %3", n, dcp::filesystem::file_size(info_file->get().path()), _info_size);
Frame first_nonexistent_frame;
if (film()->three_d()) {
changing any video.
*/
boost::system::error_code ec;
- boost::filesystem::remove (video_to, ec);
+ dcp::filesystem::remove(video_to, ec);
- boost::filesystem::create_hard_link (video_from, video_to, ec);
+ dcp::filesystem::create_hard_link(video_from, video_to, ec);
if (ec) {
LOG_WARNING("Hard-link failed (%1); copying instead", error_details(ec));
auto job = _job.lock ();
throw FileError (e.what(), video_from);
}
} else {
- boost::filesystem::copy_file (video_from, video_to, ec);
+ dcp::filesystem::copy_file(video_from, video_to, ec);
if (ec) {
LOG_ERROR("Failed to copy video file from %1 to %2 (%3)", video_from.string(), video_to.string(), error_details(ec));
throw FileError (ec.message(), video_from);
audio_to /= aaf;
boost::system::error_code ec;
- boost::filesystem::rename (film()->file(aaf), audio_to, ec);
+ dcp::filesystem::rename(film()->file(aaf), audio_to, ec);
if (ec) {
throw FileError (
String::compose(_("could not move audio asset into the DCP (%1)"), error_details(ec)), aaf
atmos_to /= aaf;
boost::system::error_code ec;
- boost::filesystem::rename (film()->file(aaf), atmos_to, ec);
+ dcp::filesystem::rename(film()->file(aaf), atmos_to, ec);
if (ec) {
throw FileError (
String::compose(_("could not move atmos asset into the DCP (%1)"), error_details(ec)), aaf
if (asset) {
if (auto interop = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(asset)) {
auto directory = output_dcp / interop->id ();
- boost::filesystem::create_directories (directory);
+ dcp::filesystem::create_directories(directory);
interop->write (directory / subtitle_asset_filename(asset, reel_index, reel_count, content_summary, ".xml"));
reel_asset = make_shared<Interop> (
interop,
*/
-#include "scoped_temporary.h"
-#include "exceptions.h"
#include "cross.h"
+#include "exceptions.h"
+#include "scoped_temporary.h"
+#include <dcp/filesystem.h>
/** Construct a ScopedTemporary. A temporary filename is decided but the file is not opened
_file->close();
}
boost::system::error_code ec;
- boost::filesystem::remove (_path, ec);
+ dcp::filesystem::remove(_path, ec);
}
#include "cross.h"
#include "compose.hpp"
#include <dcp/file.h>
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
#include <sys/stat.h>
void
SCPUploader::upload_file (boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size)
{
- auto to_do = boost::filesystem::file_size (from);
+ auto to_do = dcp::filesystem::file_size(from);
/* Use generic_string so that we get forward-slashes in the path, even on Windows */
LIBDCP_DISABLE_WARNINGS
ssh_scp_push_file (_scp, to.generic_string().c_str(), to_do, S_IRUSR | S_IWUSR);
#include "content_store.h"
#include "spl.h"
#include <libcxml/cxml.h>
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
_spl.clear ();
_missing = false;
cxml::Document doc ("SPL");
- doc.read_file (path);
+ doc.read_file(dcp::filesystem::fix_long_path(path));
_id = doc.string_child("Id");
_name = doc.string_child("Name");
for (auto i: doc.node_children("Entry")) {
#include "cross.h"
#include "state.h"
#include "util.h"
+#include <dcp/filesystem.h>
#include <glib.h>
boost::filesystem::path
State::read_path (string file)
{
- using namespace boost::filesystem;
-
for (auto i: config_versions) {
auto full = config_path_or_override(i) / file;
- if (exists(full)) {
+ if (dcp::filesystem::exists(full)) {
return full;
}
}
boost::filesystem::path
State::write_path (string file)
{
- boost::filesystem::path p = config_path_or_override(config_versions.front());
+ auto p = config_path_or_override(config_versions.front());
boost::system::error_code ec;
- boost::filesystem::create_directories (p, ec);
+ dcp::filesystem::create_directories(p, ec);
p /= file;
return p;
}
#include "subtitle_analysis.h"
#include "exceptions.h"
#include <libcxml/cxml.h>
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
{
cxml::Document f ("SubtitleAnalysis");
- f.read_file (path);
+ f.read_file(dcp::filesystem::fix_long_path(path));
if (f.optional_number_child<int>("Version").get_value_or(1) < _current_state_version) {
/* Too old. Throw an exception so that this analysis is re-run. */
#include "job.h"
#include "player.h"
#include "subtitle_encoder.h"
+#include <dcp/filesystem.h>
#include <dcp/interop_subtitle_asset.h>
#include <dcp/raw_convert.h>
#include <dcp/smpte_subtitle_asset.h>
for (int i = 0; i < files; ++i) {
boost::filesystem::path filename = output;
- if (boost::filesystem::is_directory(filename)) {
+ if (dcp::filesystem::is_directory(filename)) {
if (files > 1) {
/// TRANSLATORS: _reel%1 here is to be added to an export filename to indicate
/// which reel it is. Preserve the %1; it will be replaced with the reel number.
}
}
- _assets.push_back (make_pair(shared_ptr<dcp::SubtitleAsset>(), boost::filesystem::change_extension(filename, extension)));
+ _assets.push_back(make_pair(shared_ptr<dcp::SubtitleAsset>(), dcp::filesystem::change_extension(filename, extension)));
}
for (auto i: film->reels()) {
#include "dcpomatic_assert.h"
#include <dcp/cpl.h>
#include <dcp/dcp.h>
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/reel_asset.h>
#include <dcp/reel_file_asset.h>
}
boost::system::error_code ec;
- auto last_write = boost::filesystem::last_write_time (p, ec);
+ auto last_write = dcp::filesystem::last_write_time(p, ec);
last_write_time = ec ? 0 : last_write;
}
#include <dcp/atmos_asset.h>
#include <dcp/decrypted_kdm.h>
#include <dcp/file.h>
+#include <dcp/filesystem.h>
#include <dcp/locale_convert.h>
#include <dcp/picture_asset.h>
#include <dcp/raw_convert.h>
#ifdef DCPOMATIC_WINDOWS
putenv ("PANGOCAIRO_BACKEND=fontconfig");
- if (boost::filesystem::exists(resources_path() / "fonts.conf")) {
+ if (dcp::filesystem::exists(resources_path() / "fonts.conf")) {
/* The actual application after installation */
putenv(String::compose("FONTCONFIG_PATH=%1", resources_path().string()).c_str());
} else {
throw OpenFileError (files[i].string(), errno, OpenFileError::READ);
}
- boost::uintmax_t this_time = min (to_do, boost::filesystem::file_size (files[i]));
+ auto this_time = min(to_do, dcp::filesystem::file_size(files[i]));
f.checked_read(p, this_time);
p += this_time;
to_do -= this_time;
throw OpenFileError (files[i].string(), errno, OpenFileError::READ);
}
- boost::uintmax_t this_time = min (to_do, boost::filesystem::file_size (files[i]));
+ auto this_time = min(to_do, dcp::filesystem::file_size(files[i]));
f.seek(-this_time, SEEK_END);
f.checked_read(p, this_time);
p += this_time;
string
simple_digest (vector<boost::filesystem::path> paths)
{
- return digest_head_tail(paths, 1000000) + raw_convert<string>(boost::filesystem::file_size(paths.front()));
+ return digest_head_tail(paths, 1000000) + raw_convert<string>(dcp::filesystem::file_size(paths.front()));
}
std::vector<uint8_t> buffer(chunk);
- boost::uintmax_t const total = boost::filesystem::file_size (from);
+ auto const total = dcp::filesystem::file_size(from);
boost::uintmax_t remaining = total;
while (remaining) {
boost::filesystem::path liberation_normal;
try {
liberation_normal = resources_path() / "LiberationSans-Regular.ttf";
- if (!boost::filesystem::exists (liberation_normal)) {
+ if (!dcp::filesystem::exists(liberation_normal)) {
/* Hack for unit tests */
liberation_normal = resources_path() / "fonts" / "LiberationSans-Regular.ttf";
}
}
- if (!boost::filesystem::exists(liberation_normal)) {
+ if (!dcp::filesystem::exists(liberation_normal)) {
liberation_normal = "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf";
}
- if (!boost::filesystem::exists(liberation_normal)) {
+ if (!dcp::filesystem::exists(liberation_normal)) {
liberation_normal = "/usr/share/fonts/liberation-sans/LiberationSans-Regular.ttf";
}
bool
contains_assetmap(boost::filesystem::path dir)
{
- return boost::filesystem::is_regular_file(dir / "ASSETMAP") || boost::filesystem::is_regular_file(dir / "ASSETMAP.xml");
+ return dcp::filesystem::is_regular_file(dir / "ASSETMAP") || dcp::filesystem::is_regular_file(dir / "ASSETMAP.xml");
}
boost::uintmax_t size = 0;
for (
- auto i = boost::filesystem::recursive_directory_iterator(output_dcp);
- i != boost::filesystem::recursive_directory_iterator();
+ auto i = dcp::filesystem::recursive_directory_iterator(output_dcp);
+ i != dcp::filesystem::recursive_directory_iterator();
++i) {
- if (boost::filesystem::is_regular_file (i->path())) {
- size += boost::filesystem::file_size (i->path());
+ if (dcp::filesystem::is_regular_file(i->path())) {
+ size += dcp::filesystem::file_size(i->path());
}
}
*/
-#include "zipper.h"
-#include "exceptions.h"
#include "dcpomatic_assert.h"
+#include "exceptions.h"
+#include "zipper.h"
+#include <dcp/filesystem.h>
#include <zip.h>
#include <boost/filesystem.hpp>
#include <stdexcept>
-using std::string;
using std::runtime_error;
using std::shared_ptr;
+using std::string;
Zipper::Zipper (boost::filesystem::path file)
{
int error;
- _zip = zip_open (file.string().c_str(), ZIP_CREATE | ZIP_EXCL, &error);
+ _zip = zip_open(dcp::filesystem::fix_long_path(file).string().c_str(), ZIP_CREATE | ZIP_EXCL, &error);
if (!_zip) {
if (error == ZIP_ER_EXISTS) {
throw FileError ("ZIP file already exists", file);
#include "lib/version.h"
#include "lib/video_content.h"
#include <dcp/exceptions.h>
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
}
catch (FileNotFoundError& e) {
auto const dir = e.file().parent_path();
- if (boost::filesystem::exists(dir / "ASSETMAP") || boost::filesystem::exists(dir / "ASSETMAP.xml")) {
+ if (dcp::filesystem::exists(dir / "ASSETMAP") || dcp::filesystem::exists(dir / "ASSETMAP.xml")) {
error_dialog (
this, _("Could not open this folder as a DCP-o-matic project."),
_("It looks like you are trying to open a DCP. File -> Open is for loading DCP-o-matic projects, not DCPs. To import a DCP, create a new project with File -> New and then click the \"Add DCP...\" button.")
/* Remove any existing DCP if the user agrees */
auto const dcp_dir = _film->dir (_film->dcp_name(), false);
- if (boost::filesystem::exists(dcp_dir)) {
+ if (dcp::filesystem::exists(dcp_dir)) {
if (!confirm_dialog (this, wxString::Format (_("Do you want to overwrite the existing DCP %s?"), std_to_wx(dcp_dir.string()).data()))) {
return;
}
- boost::filesystem::remove_all (dcp_dir);
+ dcp::filesystem::remove_all(dcp_dir);
}
try {
return;
}
- if (boost::filesystem::exists(dialog.path())) {
+ if (dcp::filesystem::exists(dialog.path())) {
bool ok = confirm_dialog(
this,
wxString::Format(_("File %s already exists. Do you want to overwrite it?"), std_to_wx(dialog.path().string()).data())
signal_manager = new wxSignalManager (this);
Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1));
- if (!_film_to_load.empty() && boost::filesystem::is_directory(_film_to_load)) {
+ if (!_film_to_load.empty() && dcp::filesystem::is_directory(_film_to_load)) {
try {
_frame->load_film (_film_to_load);
} catch (exception& e) {
#include "lib/transcode_job.h"
#include "lib/util.h"
#include "lib/version.h"
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/aboutdlg.h>
if (filenames.GetCount() == 1) {
/* Try to load a directory */
auto path = boost::filesystem::path(wx_to_std(filenames[0]));
- if (boost::filesystem::is_directory(path)) {
+ if (dcp::filesystem::is_directory(path)) {
_frame->start_job(wx_to_std(filenames[0]));
return true;
}
shared_ptr<Film> film;
for (auto i: films_to_load) {
- if (boost::filesystem::is_directory(i)) {
+ if (dcp::filesystem::is_directory(i)) {
try {
film = make_shared<Film>(i);
film->read_metadata ();
#include "lib/util.h"
#include "lib/version.h"
#include "lib/video_content.h"
+#include <dcp/filesystem.h>
#include <dcp/version.h>
#include <getopt.h>
#include <iostream>
for (auto i: film->content()) {
auto paths = i->paths();
for (auto j: paths) {
- if (!boost::filesystem::exists(j)) {
+ if (!dcp::filesystem::exists(j)) {
cerr << argv[0] << ": content file " << j << " not found.\n";
exit (EXIT_FAILURE);
}
#include "lib/version.h"
#include "lib/video_content.h"
#include <dcp/exceptions.h>
+#include <dcp/filesystem.h>
#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
#include <getopt.h>
auto film = cc.make_film();
for (auto cli_content: cc.content) {
- auto const can = boost::filesystem::canonical (cli_content.path);
+ auto const can = dcp::filesystem::canonical(cli_content.path);
vector<shared_ptr<Content>> film_content_list;
- if (boost::filesystem::exists (can / "ASSETMAP") || (boost::filesystem::exists (can / "ASSETMAP.xml"))) {
+ if (dcp::filesystem::exists(can / "ASSETMAP") || (dcp::filesystem::exists(can / "ASSETMAP.xml"))) {
auto dcp = make_shared<DCPContent>(can);
film_content_list.push_back (dcp);
if (cli_content.kdm) {
#include <dcp/encrypted_kdm.h>
#include <dcp/decrypted_kdm.h>
#include <dcp/exceptions.h>
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/dnd.h>
bool confirm_overwrite (boost::filesystem::path path)
{
- if (boost::filesystem::is_directory(path)) {
+ if (dcp::filesystem::is_directory(path)) {
return confirm_dialog (
this,
wxString::Format(_("Folder %s already exists. Do you want to overwrite it?"), std_to_wx(path.string()).data())
#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/exceptions.h>
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/search.h>
#include <dcp/warnings.h>
if (filenames.GetCount() == 1) {
/* Try to load a directory */
auto path = boost::filesystem::path(wx_to_std(filenames[0]));
- if (boost::filesystem::is_directory(path)) {
+ if (dcp::filesystem::is_directory(path)) {
_frame->load_dcp(wx_to_std(filenames[0]));
return true;
}
LOG_DEBUG_PLAYER ("Failed to start play server (%1)", e.what());
}
- if (!_dcp_to_load.empty() && boost::filesystem::is_directory (_dcp_to_load)) {
+ if (!_dcp_to_load.empty() && dcp::filesystem::is_directory(_dcp_to_load)) {
try {
_frame->load_dcp (_dcp_to_load);
} catch (exception& e) {
#include "lib/film.h"
#include "lib/spl.h"
#include "lib/spl_entry.h"
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/imaglist.h>
_list->DeleteAllItems ();
_playlists.clear ();
- for (auto i: boost::filesystem::directory_iterator(*path)) {
+ for (auto i: dcp::filesystem::directory_iterator(*path)) {
auto spl = make_shared<SignalSPL>();
try {
spl->read (i, _content_store);
return;
}
- boost::filesystem::remove(*dir / (_playlists[*index]->id() + ".xml"));
+ dcp::filesystem::remove(*dir / (_playlists[*index]->id() + ".xml"));
_list->DeleteItem(*index);
_playlists.erase(_playlists.begin() + *index);
#include "lib/film.h"
#include "lib/job_manager.h"
#include "lib/maths_util.h"
+#include <dcp/filesystem.h>
#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
#include <iostream>
auto check = _content.lock();
auto const path = film->audio_analysis_path (_playlist);
- if (!boost::filesystem::exists (path)) {
+ if (!dcp::filesystem::exists(path)) {
_plot->set_analysis (shared_ptr<AudioAnalysis> ());
_analysis.reset ();
return;
}
- if (!boost::filesystem::exists (film->audio_analysis_path (_playlist))) {
+ if (!dcp::filesystem::exists(film->audio_analysis_path(_playlist))) {
/* We analysed and still nothing showed up, so maybe it was cancelled or it failed.
Give up.
*/
#include "static_text.h"
#include "lib/constants.h"
#include <dcp/file.h>
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
if (d->ShowModal() == wxID_OK) {
try {
boost::filesystem::path p (wx_to_std (d->GetPath ()));
- if (boost::filesystem::file_size (p) > 8192) {
+ if (dcp::filesystem::file_size(p) > 8192) {
error_dialog (
this,
wxString::Format (_("Could not read key file; file is too long (%s)"), std_to_wx (p.string ()))
#include "lib/string_text_file_content.h"
#include "lib/text_content.h"
#include "lib/video_content.h"
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/display.h>
vector<boost::filesystem::path> folders;
for (size_t i = 0; i < filenames.GetCount(); ++i) {
auto path = boost::filesystem::path(wx_to_std(filenames[i]));
- if (boost::filesystem::is_regular_file(path)) {
+ if (dcp::filesystem::is_regular_file(path)) {
files.push_back(path);
- } else if (boost::filesystem::is_directory(path)) {
+ } else if (dcp::filesystem::is_directory(path)) {
if (contains_assetmap(path)) {
dcps.push_back(path);
} else {
#include "lib/job_manager.h"
#include "lib/util.h"
#include <dcp/exceptions.h>
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
DeleteAllItems ();
_content.clear ();
auto dir = Config::instance()->player_content_directory();
- if (!dir || !boost::filesystem::is_directory(*dir)) {
+ if (!dir || !dcp::filesystem::is_directory(*dir)) {
dir = home_directory ();
}
)) {
return false;
}
- } else if (boost::filesystem::is_regular_file(path())) {
+ } else if (filesystem::is_regular_file(path())) {
error_dialog (
this,
String::compose (wx_to_std(_("%1 already exists as a file, so you cannot use it for a film.")), path().c_str())
#include "lib/font.h"
#include "lib/scope_guard.h"
#include "lib/text_content.h"
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/wx.h>
*/
wxString default_dir = "";
#ifdef DCPOMATIC_LINUX
- if (boost::filesystem::exists ("/usr/share/fonts/truetype")) {
+ if (dcp::filesystem::exists("/usr/share/fonts/truetype")) {
default_dir = "/usr/share/fonts/truetype";
} else {
default_dir = "/usr/share/fonts";
#include "lib/util.h"
#include <dcp/certificate_chain.h>
#include <dcp/exceptions.h>
+#include <dcp/filesystem.h>
#include <dcp/locale_convert.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
);
if (dialog.ShowModal() == wxID_OK) {
- boost::filesystem::copy_file(Config::instance()->cinemas_file(), wx_to_std(dialog.GetPath()), boost::filesystem::copy_option::overwrite_if_exists);
+ dcp::filesystem::copy_file(Config::instance()->cinemas_file(), wx_to_std(dialog.GetPath()), boost::filesystem::copy_option::overwrite_if_exists);
}
}
return;
}
bool copy_and_link = true;
- if (boost::filesystem::exists(new_file)) {
+ if (dcp::filesystem::exists(new_file)) {
ConfigMoveDialog dialog(_panel, new_file);
if (dialog.ShowModal() == wxID_OK) {
copy_and_link = false;
try {
/* XXX: hack alert */
cxml::Document cpl_document ("CompositionPlaylist");
- cpl_document.read_file (cpl_file);
+ cpl_document.read_file(dcp::filesystem::fix_long_path(cpl_file));
bool encrypted = false;
for (auto i: cpl_document.node_children("ReelList")) {
#include "system_font_dialog.h"
#include "wx_util.h"
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/listctrl.h>
fonts = boost::filesystem::path (windir) / "Fonts";
}
- for (auto i: boost::filesystem::directory_iterator (fonts)) {
+ for (auto i: dcp::filesystem::directory_iterator(fonts)) {
auto ext = i.path().extension().string();
transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
#include "lib/string_text_file_decoder.h"
#include "lib/subtitle_analysis.h"
#include "lib/text_content.h"
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/spinctrl.h>
auto const path = _parent->film()->subtitle_analysis_path(content);
- if (!boost::filesystem::exists(path)) {
+ if (!dcp::filesystem::exists(path)) {
for (auto i: JobManager::instance()->get()) {
if (dynamic_pointer_cast<AnalyseSubtitlesJob>(i) && !i->finished()) {
i->cancel ();
return;
}
- if (!boost::filesystem::exists(_parent->film()->subtitle_analysis_path(content))) {
+ if (!dcp::filesystem::exists(_parent->film()->subtitle_analysis_path(content))) {
/* We analysed and still nothing showed up, so maybe it failed. Give up. */
error_dialog (_parent->window(), _("Could not analyse subtitles."));
clear_outline_subtitles ();
#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/equality_options.h>
+#include <dcp/filesystem.h>
#include <dcp/mono_picture_asset.h>
#include <dcp/mono_picture_frame.h>
#include <dcp/openjpeg_image.h>
boost::filesystem::path TestPaths::xsd ()
{
- return boost::filesystem::canonical(boost::filesystem::path("..") / boost::filesystem::path("libdcp") / boost::filesystem::path("xsd"));
+ return boost::filesystem::current_path().parent_path() / "libdcp" / "xsd";
}
#include "lib/exceptions.h"
#include "lib/zipper.h"
#include "test.h"
+#include <dcp/filesystem.h>
#include <dcp/util.h>
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
zipper.add ("bar.txt", "xxxxxxCCCCbbbbbbb1");
zipper.close ();
+ /* Make sure we aren't in a UNC current working directory otherwise the use of cmd.exe
+ * in system() below will fail.
+ */
+ boost::filesystem::current_path(dcp::filesystem::unfix_long_path(boost::filesystem::current_path()));
+
boost::filesystem::remove_all ("build/test/zipper_test1", ec);
#ifdef DCPOMATIC_WINDOWS
/* unzip on windows crashes every so often (with a return code -1073740940, for some reason)