]> git.sesse.net Git - casparcg/commitdiff
manually merged d21afbd from master
authorniklaspandersson <niklas.p.andersson@svt.se>
Fri, 30 Aug 2013 10:21:13 +0000 (12:21 +0200)
committerniklaspandersson <niklas.p.andersson@svt.se>
Fri, 30 Aug 2013 10:21:13 +0000 (12:21 +0200)
manually merged 483ca71 from master

common/env.cpp
modules/image/producer/image_producer.cpp

index cf69aae4be428426a6aae92915e788d13eeb32f5..8e07f287b4e48cf782d7ac65c5a02f6cc0c7e9e6 100644 (file)
@@ -70,6 +70,20 @@ void configure(const std::wstring& filename)
                font            = paths.get(L"font-path", initialPath + L"\\fonts\\");
                thumbnails      = paths.get(L"thumbnails-path", initialPath + L"\\data\\");
 
+               //Make sure that all paths have a trailing backslash
+               if(media.at(media.length()-1) != L'\\')
+                       media.append(L"\\");
+               if(log.at(log.length()-1) != L'\\')
+                       log.append(L"\\");
+               if(ftemplate.at(ftemplate.length()-1) != L'\\')
+                       ftemplate.append(L"\\");
+               if(data.at(data.length()-1) != L'\\')
+                       data.append(L"\\");
+               if(font.at(font.length()-1) != L'\\')
+                       font.append(L"\\");
+               if(thumbnails.at(thumbnails.length()-1) != L'\\')
+                       thumbnails.append(L"\\");
+
                try
                {
                        for(auto it = boost::filesystem::directory_iterator(initialPath); it != boost::filesystem::directory_iterator(); ++it)
@@ -123,6 +137,10 @@ void configure(const std::wstring& filename)
                if(!boost::filesystem::exists(data_path))
                        boost::filesystem::create_directories(data_path);
 
+               auto font_path = boost::filesystem::path(font);
+               if(!boost::filesystem::exists(font_path))
+                       boost::filesystem::create_directories(font_path);
+
                auto thumbnails_path = boost::filesystem::path(thumbnails);
                if(!boost::filesystem::exists(thumbnails_path))
                        boost::filesystem::create_directories(thumbnails_path);
index 802771f68d0bcf2399b87382cb6a9ba91a4bbaa8..6b0fd8d2420cc61fddf490f13ef2d8c64c6aa93b 100644 (file)
@@ -162,7 +162,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
                if (params.size() != 2)
                        return core::frame_producer::empty();
 
-               auto dir = boost::filesystem::path(env::media_folder() + L"\\" + params[1]).parent_path();
+               auto dir = boost::filesystem::path(env::media_folder() + params[1]).parent_path();
                auto basename = boost::filesystem3::basename(params[1]);
                std::set<std::wstring> files;
                boost::filesystem::directory_iterator end;
@@ -206,7 +206,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
                return core::create_const_producer(std::move(frames), width, height);
        }
 
-       std::wstring filename = env::media_folder() + L"\\" + params[0];
+       std::wstring filename = env::media_folder() + params[0];
 
        auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool
                {