X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=common%2Fenv.cpp;h=a47ae22fe0eaf04a995f677b0eff8a8228a70f8c;hb=e5770670a865f6a4f85245c7f895acb03f295e26;hp=571797609f2c99b58455e93832a672e5c04f0cd3;hpb=304d3e221a59afb3d8c581b96db737c5fbc70953;p=casparcg diff --git a/common/env.cpp b/common/env.cpp index 571797609..a47ae22fe 100644 --- a/common/env.cpp +++ b/common/env.cpp @@ -32,6 +32,7 @@ #include #include +#include namespace caspar { namespace env { @@ -40,7 +41,6 @@ using namespace boost::filesystem2; std::wstring media; std::wstring log; std::wstring ftemplate; -std::wstring ftemplate_host; std::wstring data; boost::property_tree::ptree pt; @@ -52,18 +52,23 @@ void check_is_configured() void configure(const std::string& filename) { - std::string initialPath = boost::filesystem::initial_path().file_string(); + try + { + std::string initialPath = boost::filesystem::initial_path().file_string(); - boost::property_tree::read_xml(initialPath + "\\" + filename, pt); - - auto paths = pt.get_child("configuration.paths"); - media = widen(paths.get("media-path", initialPath + "\\media\\")); - log = widen(paths.get("log-path", initialPath + "\\log\\")); - ftemplate = complete(wpath(widen(paths.get("template-path", initialPath + "\\template\\")))).string(); - - ftemplate_host = widen(paths.get("template-host", "cg.fth")); - - data = widen(paths.get("data-path", initialPath + "\\data\\")); + boost::property_tree::read_xml(initialPath + "\\" + filename, pt, boost::property_tree::xml_parser::trim_whitespace | boost::property_tree::xml_parser::no_comments); + + auto paths = pt.get_child("configuration.paths"); + media = widen(paths.get("media-path", initialPath + "\\media\\")); + log = widen(paths.get("log-path", initialPath + "\\log\\")); + ftemplate = complete(wpath(widen(paths.get("template-path", initialPath + "\\template\\")))).string(); + data = widen(paths.get("data-path", initialPath + "\\data\\")); + } + catch(...) + { + std::wcout << L" ### Invalid configuration file. ###"; + throw; + } } const std::wstring& media_folder() @@ -84,12 +89,6 @@ const std::wstring& template_folder() return ftemplate; } -const std::wstring& template_host() -{ - check_is_configured(); - return ftemplate_host; -} - const std::wstring& data_folder() { check_is_configured(); @@ -98,7 +97,7 @@ const std::wstring& data_folder() const std::wstring& version() { - static std::wstring ver = std::wstring(L"") + CASPAR_GEN + L"." + CASPAR_MAYOR + L"." + CASPAR_MINOR + L"." + CASPAR_REV + L" ALPHA"; + static std::wstring ver = std::wstring(L"") + CASPAR_GEN + L"." + CASPAR_MAYOR + L"." + CASPAR_MINOR + L"." + CASPAR_REV + L" " + CASPAR_TAG; return ver; }