]> git.sesse.net Git - casparcg/blobdiff - common/env.cpp
Made MIXER CROP work more as one might expect
[casparcg] / common / env.cpp
index 91d0969d3334abe69ec0360e9df39b83267d970a..d2e941bbcfafd39f39f6ea4e80b3d26000039be3 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+* Copyright 2013 Sveriges Television AB http://casparcg.com/\r
 *\r
 * This file is part of CasparCG (www.casparcg.com).\r
 *\r
@@ -45,6 +45,7 @@ std::wstring media;
 std::wstring log;\r
 std::wstring ftemplate;\r
 std::wstring data;\r
+std::wstring thumbnails;\r
 boost::property_tree::wptree pt;\r
 \r
 void check_is_configured()\r
@@ -67,6 +68,19 @@ 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
+               thumbnails = widen(paths.get(L"thumbnails-path", initialPath + L"\\thumbnails\\"));\r
+\r
+               //Make sure that all paths have a trailing backslash\r
+               if(media.at(media.length()-1) != L'\\')\r
+                       media.append(L"\\");\r
+               if(log.at(log.length()-1) != L'\\')\r
+                       log.append(L"\\");\r
+               if(ftemplate.at(ftemplate.length()-1) != L'\\')\r
+                       ftemplate.append(L"\\");\r
+               if(data.at(data.length()-1) != L'\\')\r
+                       data.append(L"\\");\r
+               if(thumbnails.at(thumbnails.length()-1) != L'\\')\r
+                       thumbnails.append(L"\\");\r
 \r
                try\r
                {\r
@@ -113,6 +127,10 @@ void configure(const std::wstring& filename)
                auto data_path = boost::filesystem::wpath(data);\r
                if(!boost::filesystem::exists(data_path))\r
                        boost::filesystem::create_directory(data_path);\r
+               \r
+               auto thumbnails_path = boost::filesystem::wpath(thumbnails);\r
+               if(!boost::filesystem::exists(thumbnails_path))\r
+                       boost::filesystem::create_directory(thumbnails_path);\r
        }\r
        catch(...)\r
        {\r
@@ -145,6 +163,12 @@ const std::wstring& data_folder()
        return data;\r
 }\r
 \r
+const std::wstring& thumbnails_folder()\r
+{\r
+       check_is_configured();\r
+       return thumbnails;\r
+}\r
+\r
 #define QUOTE(str) #str\r
 #define EXPAND_AND_QUOTE(str) QUOTE(str)\r
 \r
@@ -154,7 +178,7 @@ const std::wstring& version()
                        EXPAND_AND_QUOTE(CASPAR_GEN)    "." \r
                        EXPAND_AND_QUOTE(CASPAR_MAYOR)  "." \r
                        EXPAND_AND_QUOTE(CASPAR_MINOR)  "." \r
-                       EXPAND_AND_QUOTE(CASPAR_REV)    " " \r
+                       CASPAR_REV      " " \r
                        CASPAR_TAG);\r
        return ver;\r
 }\r