summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-10-06 02:37:16 +0200
committerCarl Hetherington <cth@carlh.net>2023-10-09 01:21:22 +0200
commitf0f4dd5e6b6ed5e50d0444a4de3b2a13156edf64 (patch)
treedce96c211c6d92062187e8c40026c04a26af72e9 /src/wx
parent89e39ea9e20bc4f8e88e42a57d4505e1fa69fde5 (diff)
Use dcp::filesystem to wrap filesystem calls and fix_long_path2623-add-windows
anything that is passed to read_file() from libcxml. This should fix #2623 and other similar problems.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/audio_dialog.cc5
-rw-r--r--src/wx/config_dialog.cc3
-rw-r--r--src/wx/content_panel.cc5
-rw-r--r--src/wx/content_view.cc3
-rw-r--r--src/wx/film_name_location_dialog.cc2
-rw-r--r--src/wx/fonts_dialog.cc3
-rw-r--r--src/wx/full_config_dialog.cc5
-rw-r--r--src/wx/kdm_cpl_panel.cc2
-rw-r--r--src/wx/system_font_dialog.cc3
-rw-r--r--src/wx/text_panel.cc5
10 files changed, 22 insertions, 14 deletions
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc
index 88377b4e4..714bf78e4 100644
--- a/src/wx/audio_dialog.cc
+++ b/src/wx/audio_dialog.cc
@@ -30,6 +30,7 @@
#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>
@@ -207,7 +208,7 @@ AudioDialog::try_to_load_analysis ()
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 ();
@@ -295,7 +296,7 @@ AudioDialog::analysis_finished ()
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.
*/
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index fdb7947da..00ae80a4c 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -27,6 +27,7 @@
#include "static_text.h"
#include "lib/constants.h"
#include <dcp/file.h>
+#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
@@ -576,7 +577,7 @@ CertificateChainEditor::import_private_key ()
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 ()))
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index fadcade31..56c1d0524 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -51,6 +51,7 @@
#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>
@@ -152,9 +153,9 @@ public:
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 {
diff --git a/src/wx/content_view.cc b/src/wx/content_view.cc
index 73cc9e68b..b9fe7ce00 100644
--- a/src/wx/content_view.cc
+++ b/src/wx/content_view.cc
@@ -30,6 +30,7 @@
#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>
@@ -81,7 +82,7 @@ ContentView::update ()
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 ();
}
diff --git a/src/wx/film_name_location_dialog.cc b/src/wx/film_name_location_dialog.cc
index 5c6f97f99..05ffa7a68 100644
--- a/src/wx/film_name_location_dialog.cc
+++ b/src/wx/film_name_location_dialog.cc
@@ -150,7 +150,7 @@ FilmNameLocationDialog::check_path ()
)) {
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())
diff --git a/src/wx/fonts_dialog.cc b/src/wx/fonts_dialog.cc
index c59607e8f..a035a5ffc 100644
--- a/src/wx/fonts_dialog.cc
+++ b/src/wx/fonts_dialog.cc
@@ -27,6 +27,7 @@
#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>
@@ -174,7 +175,7 @@ FontsDialog::set_from_file_clicked ()
*/
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";
diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc
index c61c75ece..175d78730 100644
--- a/src/wx/full_config_dialog.cc
+++ b/src/wx/full_config_dialog.cc
@@ -57,6 +57,7 @@
#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
@@ -186,7 +187,7 @@ private:
);
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);
}
}
@@ -220,7 +221,7 @@ private:
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;
diff --git a/src/wx/kdm_cpl_panel.cc b/src/wx/kdm_cpl_panel.cc
index 1ddaa90cf..2a307c60c 100644
--- a/src/wx/kdm_cpl_panel.cc
+++ b/src/wx/kdm_cpl_panel.cc
@@ -112,7 +112,7 @@ KDMCPLPanel::cpl_browse_clicked ()
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")) {
diff --git a/src/wx/system_font_dialog.cc b/src/wx/system_font_dialog.cc
index 1681dd1e3..84285de12 100644
--- a/src/wx/system_font_dialog.cc
+++ b/src/wx/system_font_dialog.cc
@@ -21,6 +21,7 @@
#include "system_font_dialog.h"
#include "wx_util.h"
+#include <dcp/filesystem.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/listctrl.h>
@@ -43,7 +44,7 @@ SystemFontDialog::SystemFontDialog (wxWindow* parent)
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);
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc
index ff4e26a57..3b7973e30 100644
--- a/src/wx/text_panel.cc
+++ b/src/wx/text_panel.cc
@@ -47,6 +47,7 @@
#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>
@@ -827,7 +828,7 @@ TextPanel::try_to_load_analysis ()
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 ();
@@ -898,7 +899,7 @@ TextPanel::analysis_finished(Job::Result result)
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 ();