5 #include "../version.h"
\r
7 #include "exception\exceptions.h"
\r
8 #include "utility/string.h"
\r
10 #include <boost/property_tree/ptree.hpp>
\r
11 #include <boost/property_tree/xml_parser.hpp>
\r
12 #include <boost/filesystem.hpp>
\r
13 #include <boost/thread/once.hpp>
\r
15 #include <functional>
\r
17 namespace caspar { namespace env {
\r
21 std::wstring ftemplate;
\r
22 std::wstring ftemplate_host;
\r
24 boost::property_tree::ptree pt;
\r
26 void check_is_configured()
\r
29 BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Enviroment properties has not been configured"));
\r
32 void configure(const std::string& filename)
\r
34 std::string initialPath = boost::filesystem::initial_path().file_string();
\r
36 boost::property_tree::read_xml(initialPath + "\\" + filename, pt);
\r
38 auto paths = pt.get_child("configuration.paths");
\r
39 media = widen(paths.get("media-path", initialPath + "\\media\\"));
\r
40 log = widen(paths.get("log-path", initialPath + "\\log\\"));
\r
41 ftemplate = widen(paths.get("template-path", initialPath + "\\template\\"));
\r
42 ftemplate_host = widen(paths.get("template-host", "cg.fth"));
\r
43 data = widen(paths.get("data-path", initialPath + "\\data\\"));
\r
46 const std::wstring& media_folder()
\r
48 check_is_configured();
\r
52 const std::wstring& log_folder()
\r
54 check_is_configured();
\r
58 const std::wstring& template_folder()
\r
60 check_is_configured();
\r
64 const std::wstring& template_host()
\r
66 check_is_configured();
\r
67 return ftemplate_host;
\r
70 const std::wstring& data_folder()
\r
72 check_is_configured();
\r
76 const std::wstring& version()
\r
78 static std::wstring ver = std::wstring(L"") + CASPAR_GEN + L"." + CASPAR_MAYOR + L"." + CASPAR_MINOR + L"." + CASPAR_REV;
\r
82 const boost::property_tree::ptree& properties()
\r
84 check_is_configured();
\r