- media = paths.get(L"media-path", initialPath + L"\\media\\");
- log = paths.get(L"log-path", initialPath + L"\\log\\");
- ftemplate = boost::filesystem3::complete(paths.get(L"template-path", initialPath + L"\\template\\")).wstring();
- data = paths.get(L"data-path", initialPath + L"\\data\\");
+ media = paths.get(L"media-path", initialPath + L"/media/");
+ log = paths.get(L"log-path", initialPath + L"/log/");
+ ftemplate = boost::filesystem::complete(paths.get(L"template-path", initialPath + L"/template/")).wstring();
+ data = paths.get(L"data-path", initialPath + L"/data/");
+ font = paths.get(L"font-path", initialPath + L"/font/");
+ thumbnails = paths.get(L"thumbnail-path", initialPath + L"/thumbnail/");
+ }
+ catch(...)
+ {
+ CASPAR_LOG(error) << L" ### Invalid configuration file. ###";
+ throw;
+ }
+
+ try
+ {
+ auto found_media_path = find_case_insensitive(media);
+ if (found_media_path)
+ media = *found_media_path;
+ else
+ boost::filesystem::create_directories(media);
+
+ auto found_template_path = find_case_insensitive(ftemplate);
+ if (found_template_path)
+ ftemplate = *found_template_path;
+ else
+ boost::filesystem::create_directories(ftemplate);
+
+ auto found_data_path = find_case_insensitive(data);
+ if (found_data_path)
+ data = *found_data_path;
+ else
+ boost::filesystem::create_directories(data);
+
+ auto found_font_path = find_case_insensitive(font);
+ if (found_font_path)
+ font = *found_font_path;
+ else
+ boost::filesystem::create_directories(font);
+
+ auto found_thumbnails_path = find_case_insensitive(thumbnails);
+ if (found_thumbnails_path)
+ thumbnails = *found_thumbnails_path;
+ else
+ boost::filesystem::create_directories(thumbnails);
+
+ auto found_log_path = find_case_insensitive(log);
+ if (found_log_path)
+ log = *found_log_path;
+ else if (!boost::filesystem::create_directories(log))
+ log = L"./";
+
+ //Make sure that all paths have a trailing slash
+ 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"/");