From 0e0c323833972ea1896c05f50e407b566ca12ead Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 28 Sep 2014 23:52:33 +0100 Subject: Better error when copying the video file into the DCP fails. --- src/lib/writer.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/writer.cc b/src/lib/writer.cc index dd2e98eee..5af1aea1e 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -45,6 +45,7 @@ #define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); #define LOG_TIMING(...) _film->log()->microsecond_log (String::compose (__VA_ARGS__), Log::TYPE_TIMING); #define LOG_WARNING_NC(...) _film->log()->log (__VA_ARGS__, Log::TYPE_WARNING); +#define LOG_ERROR(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_ERROR); /* OS X strikes again */ #undef set_key @@ -412,9 +413,12 @@ Writer::finish () boost::system::error_code ec; boost::filesystem::create_hard_link (video_from, video_to, ec); if (ec) { - /* hard link failed; copy instead */ - boost::filesystem::copy_file (video_from, video_to); - LOG_WARNING_NC ("Hard-link failed; fell back to copying"); + LOG_WARNING_NC ("Hard-link failed; copying instead"); + boost::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(), ec.message ()); + throw FileError (ec.message(), video_from); + } } /* And update the asset */ -- cgit v1.2.3