From: Helge Norberg Date: Tue, 21 Mar 2017 10:07:00 +0000 (+0100) Subject: [thumbnail_generator] #579 Throw file_not_found in generate() for non existant media... X-Git-Tag: 2.1.0_Beta2~38 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ffa1282b3ebbb69084a3a0a36ec4cea5b8d6f11c;hp=c9a719864d0a99a3d63f454f66dc744be6567cdf;p=casparcg [thumbnail_generator] #579 Throw file_not_found in generate() for non existant media files. --- 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()