From a620d85fec786161f15594de4d971d5676b08986 Mon Sep 17 00:00:00 2001 From: Helge Norberg Date: Tue, 22 Nov 2016 15:08:20 +0100 Subject: [PATCH] [env] Added backwards compatibility (with deprecation warning) for using thumbnails-path instead of thumbnail-path in casparcg.config. --- CHANGELOG | 2 ++ common/env.cpp | 11 ++++++++++- common/env.h | 2 ++ shell/main.cpp | 5 ++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3da21ca17..6982a208c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,8 @@ General o Fail early with clear error message if configured paths are not creatable/writable. + o Added backwards compatibility (with deprecation warning) for using + thumbnails-path instead of thumbnail-path in casparcg.config. CasparCG 2.1.0 Beta 1 (w.r.t 2.0.7 Stable) ========================================== diff --git a/common/env.cpp b/common/env.cpp index 6984e2d82..b97daca05 100644 --- a/common/env.cpp +++ b/common/env.cpp @@ -125,7 +125,7 @@ void configure(const std::wstring& filename) ftemplate = clean_path(boost::filesystem::complete(paths.get(L"template-path", initial + L"/template/")).wstring()); data = clean_path(paths.get(L"data-path", initial + L"/data/")); font = clean_path(paths.get(L"font-path", initial + L"/font/")); - thumbnails = clean_path(paths.get(L"thumbnail-path", initial + L"/thumbnail/")); + thumbnails = clean_path(paths.get(L"thumbnail-path", paths.get(L"thumbnails-path", initial + L"/thumbnail/"))); } catch (...) { @@ -208,4 +208,13 @@ const boost::property_tree::wptree& properties() return pt; } +void log_configuration_warnings() +{ + if (pt.empty()) + return; + + if (pt.get_optional(L"configuration.paths.thumbnails-path")) + CASPAR_LOG(warning) << L"Element thumbnails-path in casparcg.config has been deprecated. Use thumbnail-path instead."; +} + }} diff --git a/common/env.h b/common/env.h index da4cde38d..d53776eec 100644 --- a/common/env.h +++ b/common/env.h @@ -40,4 +40,6 @@ const std::wstring& version(); const boost::property_tree::wptree& properties(); +void log_configuration_warnings(); + } } diff --git a/shell/main.cpp b/shell/main.cpp index 6ae71f153..76b465d06 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -324,6 +324,9 @@ int main(int argc, char** argv) log::add_file_sink(env::log_folder() + L"calltrace", caspar::log::category == caspar::log::log_category::calltrace); std::wcout << L"Logging [info] or higher severity to " << env::log_folder() << std::endl << std::endl; + // Once logging to file, log configuration warnings. + env::log_configuration_warnings(); + // Setup console window. setup_console_window(); @@ -350,7 +353,7 @@ int main(int argc, char** argv) } catch (const user_error& e) { - CASPAR_LOG(fatal) << get_message_and_context(e) << " Please check the configuration file (" << u8(config_file_name) << ") for errors. Turn on log level debug for stacktrace."; + CASPAR_LOG(fatal) << get_message_and_context(e) << " Please check the configuration file (" << u8(config_file_name) << ") for errors."; wait_for_keypress(); } catch(...) -- 2.39.2