fix unicode handling in is_regular_file check - refs #2273

This commit is contained in:
Dane Springmeyer 2014-06-18 12:55:59 -07:00
parent 5688a93858
commit 184d9dd43b
3 changed files with 11 additions and 1 deletions

View file

@ -33,6 +33,7 @@ namespace mapnik { namespace util {
MAPNIK_DECL bool exists(std::string const& value);
MAPNIK_DECL bool is_directory(std::string const& value);
MAPNIK_DECL bool is_regular_file(std::string const& value);
MAPNIK_DECL bool remove(std::string const& value);
MAPNIK_DECL bool is_relative(std::string const& value);
MAPNIK_DECL std::string make_relative(std::string const& filepath, std::string const& base);

View file

@ -213,7 +213,7 @@ bool freetype_engine::register_fonts_impl(std::string const& dir, FT_LibraryRec_
std::string base_name = itr->filename();
#endif
if (!boost::algorithm::starts_with(base_name,".") &&
boost::filesystem::is_regular_file(file_name) &&
mapnik::util::is_regular_file(file_name) &&
is_font_file(file_name))
{
if (mapnik::freetype_engine::register_font_impl(file_name, library))

View file

@ -88,6 +88,15 @@ namespace util {
#endif
}
bool is_regular_file(std::string const& filepath)
{
#ifdef _WINDOWS
return boost::filesystem::is_regular_file(mapnik::utf8_to_utf16(filepath));
#else
return boost::filesystem::is_regular_file(filepath);
#endif
}
bool remove(std::string const& filepath)
{
#ifdef _WINDOWS