summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/filesystem.cc10
-rw-r--r--src/filesystem.h13
2 files changed, 14 insertions, 9 deletions
diff --git a/src/filesystem.cc b/src/filesystem.cc
index 98c3d1b7..4cbbc3d4 100644
--- a/src/filesystem.cc
+++ b/src/filesystem.cc
@@ -107,13 +107,15 @@ dcp::filesystem::copy_file(boost::filesystem::path const& from, boost::filesyste
void
+dcp::filesystem::copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, CopyOptions option)
+{
#ifdef LIBDCP_HAVE_COPY_OPTIONS
-dcp::filesystem::copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, boost::filesystem::copy_options option)
+ auto const options = option == CopyOptions::OVERWRITE_EXISTING ? boost::filesystem::copy_options::overwrite_existing : boost::filesystem::copy_options::none;
#else
-dcp::filesystem::copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, boost::filesystem::copy_option option)
+ auto const options = option == CopyOptions::OVERWRITE_EXISTING ? boost::filesystem::copy_option::overwrite_if_exists : boost::filesystem::copy_option::none;
#endif
-{
- boost::filesystem::copy_file(dcp::filesystem::fix_long_path(from), dcp::filesystem::fix_long_path(to), option);
+
+ boost::filesystem::copy_file(dcp::filesystem::fix_long_path(from), dcp::filesystem::fix_long_path(to), options);
}
diff --git a/src/filesystem.h b/src/filesystem.h
index 679be1f9..a06dc69e 100644
--- a/src/filesystem.h
+++ b/src/filesystem.h
@@ -51,11 +51,14 @@ boost::filesystem::path change_extension(boost::filesystem::path const& from, st
void copy(boost::filesystem::path const& from, boost::filesystem::path const& to);
void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to);
void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, boost::system::error_code& ec);
-#ifdef LIBDCP_HAVE_COPY_OPTIONS
-void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, boost::filesystem::copy_options ec);
-#else
-void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, boost::filesystem::copy_option ec);
-#endif
+
+enum class CopyOptions
+{
+ NONE,
+ OVERWRITE_EXISTING
+};
+
+void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, CopyOptions options);
bool create_directory(boost::filesystem::path const& path);
bool create_directory(boost::filesystem::path const& path, boost::system::error_code& ec);
bool create_directories(boost::filesystem::path const& path);