forked from HowardHinnant/date
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:
committed by
Howard Hinnant
parent
de458e9b99
commit
91c05caaff
11
tz.cpp
11
tz.cpp
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user