]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 28 Jul 2011 09:36:43 +0000 (09:36 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 28 Jul 2011 09:36:43 +0000 (09:36 +0000)
common/env.cpp

index 571797609f2c99b58455e93832a672e5c04f0cd3..209e530c77408f9f6da3b18d1df7fb0b92d57cfe 100644 (file)
@@ -32,6 +32,7 @@
 #include <boost/thread/once.hpp>\r
 \r
 #include <functional>\r
+#include <iostream>\r
 \r
 namespace caspar { namespace env {\r
 \r
@@ -52,18 +53,26 @@ void check_is_configured()
 \r
 void configure(const std::string& filename)\r
 {\r
-       std::string initialPath = boost::filesystem::initial_path().file_string();\r
+       try\r
+       {\r
+               std::string initialPath = boost::filesystem::initial_path().file_string();\r
        \r
-       boost::property_tree::read_xml(initialPath + "\\" + filename, pt);\r
-\r
-       auto paths = pt.get_child("configuration.paths");\r
-       media = widen(paths.get("media-path", initialPath + "\\media\\"));\r
-       log = widen(paths.get("log-path", initialPath + "\\log\\"));\r
-       ftemplate = complete(wpath(widen(paths.get("template-path", initialPath + "\\template\\")))).string();\r
-\r
-       ftemplate_host = widen(paths.get("template-host", "cg.fth"));\r
-\r
-       data = widen(paths.get("data-path", initialPath + "\\data\\"));\r
+               boost::property_tree::read_xml(initialPath + "\\" + filename, pt);\r
+\r
+               auto paths = pt.get_child("configuration.paths");\r
+               media = widen(paths.get("media-path", initialPath + "\\media\\"));\r
+               log = widen(paths.get("log-path", initialPath + "\\log\\"));\r
+               ftemplate = complete(wpath(widen(paths.get("template-path", initialPath + "\\template\\")))).string();\r
+\r
+               ftemplate_host = widen(paths.get("template-host", "cg.fth"));\r
+\r
+               data = widen(paths.get("data-path", initialPath + "\\data\\"));\r
+       }\r
+       catch(...)\r
+       {\r
+               std::wcout << L" ### Invalid configuration file. ###";\r
+               throw;\r
+       }\r
 }\r
        \r
 const std::wstring& media_folder()\r