Better error when copying the video file into the DCP fails.
authorCarl Hetherington <cth@carlh.net>
Sun, 28 Sep 2014 22:52:33 +0000 (23:52 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 28 Sep 2014 22:52:33 +0000 (23:52 +0100)
src/lib/writer.cc

index dd2e98eeed5e0b33e484773fea63890a95e4aaa9..5af1aea1e1d8f15ea25c27017f60e9817cb55c9e 100644 (file)
@@ -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 */