]> git.sesse.net Git - casparcg/commitdiff
Copy templates automatically from initial-path to template-path.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 19 Jan 2012 18:53:28 +0000 (18:53 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 19 Jan 2012 18:53:28 +0000 (18:53 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/trunk@2133 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

common/env.cpp

index 4dde3c7823b0ad46cbd522d995c7f6d2a173cf6e..21738e85486d65720b3986426daec5770d8bf307 100644 (file)
@@ -67,6 +67,28 @@ void configure(const std::wstring& filename)
                log = widen(paths.get(L"log-path", initialPath + L"\\log\\"));\r
                ftemplate = complete(wpath(widen(paths.get(L"template-path", initialPath + L"\\template\\")))).string();                \r
                data = widen(paths.get(L"data-path", initialPath + L"\\data\\"));\r
+\r
+               try\r
+               {\r
+                       for(auto it = boost::filesystem2::wdirectory_iterator(initialPath); it != boost::filesystem2::wdirectory_iterator(); ++it)\r
+                       {\r
+                               if(it->filename().find(L".fth") != std::wstring::npos)                  \r
+                               {\r
+                                       auto from_path = *it;\r
+                                       auto to_path = boost::filesystem2::wpath(ftemplate + L"/" + it->filename());\r
+                               \r
+                                       if(boost::filesystem2::exists(to_path))\r
+                                               boost::filesystem2::remove(to_path);\r
+\r
+                                       boost::filesystem2::copy_file(from_path, to_path);\r
+                               }       \r
+                       }\r
+               }\r
+               catch(...)\r
+               {\r
+                       CASPAR_LOG_CURRENT_EXCEPTION();\r
+                       CASPAR_LOG(error) << L"Failed to copy template-hosts from initial-path to template-path.";\r
+               }\r
        }\r
        catch(...)\r
        {\r