From ffa1282b3ebbb69084a3a0a36ec4cea5b8d6f11c Mon Sep 17 00:00:00 2001 From: Helge Norberg Date: Tue, 21 Mar 2017 11:07:00 +0100 Subject: [PATCH] [thumbnail_generator] #579 Throw file_not_found in generate() for non existant media files. --- core/thumbnail_generator.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/thumbnail_generator.cpp b/core/thumbnail_generator.cpp index 7f41ed3a3..b2a00e957 100644 --- a/core/thumbnail_generator.cpp +++ b/core/thumbnail_generator.cpp @@ -171,16 +171,24 @@ public: void generate(const std::wstring& media_file) { using namespace boost::filesystem; - auto base_file = media_path_ / media_file; - auto folder = base_file.parent_path(); + + auto base_file = media_path_ / media_file; + auto folder = base_file.parent_path(); + bool found = false; for (boost::filesystem::directory_iterator iter(folder); iter != boost::filesystem::directory_iterator(); ++iter) { auto stem = iter->path().stem(); if (boost::iequals(stem.wstring(), base_file.filename().wstring())) + { monitor_->reemmit(iter->path()); + found = true; + } } + + if (!found) + CASPAR_THROW_EXCEPTION(file_not_found() << msg_info(L"Media file " + media_file + L" not found")); } void generate_all() -- 2.39.2