Check if mapping file exists when !AUTO_DOWNLOAD

~ Check if the windowsZones.xml realy exists to not segfault in TinyXml parser.
~ Remove old TimeZoneMappings.csv mapping from repo. Use the http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml instead.
This commit is contained in:
nico-engels
2016-06-19 22:39:01 -03:00
committed by Howard Hinnant
parent de458e9b99
commit 91c05caaff
2 changed files with 10 additions and 454 deletions

11
tz.cpp
View File

@@ -360,7 +360,16 @@ load_zone_mappings_from_xml_file(const std::string& input_path)
using tinyxml2::XMLDocument;
std::vector<date::detail::timezone_mapping> zone_map_list;
XMLDocument doc;
doc.LoadFile(input_path.c_str());
auto result = doc.LoadFile(input_path.c_str());
if (result != tinyxml2::XML_SUCCESS)
{
std::string msg = "Could not load the timezone mapping file at \"";
msg += input_path;
msg += '\"';
throw std::runtime_error(msg);
}
auto supplementalData = doc.FirstChildElement("supplementalData");
auto windowsZones = supplementalData->FirstChildElement("windowsZones");
auto mapTimeZones = windowsZones->FirstChildElement("mapTimezones");