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 19bd20f8a6
commit a96fc9e9cc
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

@ -185,7 +185,7 @@ bool freetype_engine::register_fonts(std::string const& dir, bool recurse)
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(file_name))

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