fix boost directory iterator to use wide paths - closes #2273
Conflicts: src/font_engine_freetype.cpp
This commit is contained in:
parent
6572cde97a
commit
8ae1b6da03
2 changed files with 23 additions and 1 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include <mapnik/params.hpp>
|
#include <mapnik/params.hpp>
|
||||||
#include <mapnik/plugin.hpp>
|
#include <mapnik/plugin.hpp>
|
||||||
#include <mapnik/util/fs.hpp>
|
#include <mapnik/util/fs.hpp>
|
||||||
|
#include <mapnik/utils.hpp>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
@ -169,7 +170,12 @@ void datasource_cache::register_datasources(std::string const& str)
|
||||||
if (mapnik::util::exists(str) && mapnik::util::is_directory(str))
|
if (mapnik::util::exists(str) && mapnik::util::is_directory(str))
|
||||||
{
|
{
|
||||||
boost::filesystem::directory_iterator end_itr;
|
boost::filesystem::directory_iterator end_itr;
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
std::wstring wide_dir(mapnik::utf8_to_utf16(str));
|
||||||
|
for (boost::filesystem::directory_iterator itr(wide_dir); itr != end_itr; ++itr)
|
||||||
|
#else
|
||||||
for (boost::filesystem::directory_iterator itr(str); itr != end_itr; ++itr )
|
for (boost::filesystem::directory_iterator itr(str); itr != end_itr; ++itr )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <mapnik/pixel_position.hpp>
|
#include <mapnik/pixel_position.hpp>
|
||||||
#include <mapnik/text/face.hpp>
|
#include <mapnik/text/face.hpp>
|
||||||
#include <mapnik/util/fs.hpp>
|
#include <mapnik/util/fs.hpp>
|
||||||
|
#include <mapnik/utils.hpp>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
@ -130,7 +131,11 @@ bool freetype_engine::register_font(std::string const& file_name)
|
||||||
|
|
||||||
bool freetype_engine::register_font_impl(std::string const& file_name, FT_LibraryRec_ * library)
|
bool freetype_engine::register_font_impl(std::string const& file_name, FT_LibraryRec_ * library)
|
||||||
{
|
{
|
||||||
std::ifstream file(file_name.c_str() , std::ios::binary);
|
#ifdef _WINDOWS
|
||||||
|
std::ifstream file(mapnik::utf8_to_utf16(file_name), std::ios::binary);
|
||||||
|
#else
|
||||||
|
std::ifstream file(file_name.c_str(), std::ios::binary);
|
||||||
|
#endif
|
||||||
if (!file.good()) {
|
if (!file.good()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -227,12 +232,23 @@ bool freetype_engine::register_fonts_impl(std::string const& dir, FT_LibraryRec_
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boost::filesystem::directory_iterator end_itr;
|
boost::filesystem::directory_iterator end_itr;
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
std::wstring wide_dir(mapnik::utf8_to_utf16(dir));
|
||||||
|
for (boost::filesystem::directory_iterator itr(wide_dir); itr != end_itr; ++itr)
|
||||||
|
{
|
||||||
|
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||||
|
std::string file_name = mapnik::utf16_to_utf8(itr->path().wstring());
|
||||||
|
#else // v2
|
||||||
|
std::string file_name = mapnik::utf16_to_utf8(itr->wstring());
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
for (boost::filesystem::directory_iterator itr(dir); itr != end_itr; ++itr)
|
for (boost::filesystem::directory_iterator itr(dir); itr != end_itr; ++itr)
|
||||||
{
|
{
|
||||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||||
std::string file_name = itr->path().string();
|
std::string file_name = itr->path().string();
|
||||||
#else // v2
|
#else // v2
|
||||||
std::string file_name = itr->string();
|
std::string file_name = itr->string();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (boost::filesystem::is_directory(*itr) && recurse)
|
if (boost::filesystem::is_directory(*itr) && recurse)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue