Have get_version check for the file named version first

This commit is contained in:
Howard Hinnant
2017-01-01 15:02:08 -05:00
parent 4a1c49152f
commit 2935f80109

12
tz.cpp
View File

@@ -2726,8 +2726,17 @@ static
std::string
get_version(const std::string& path)
{
std::ifstream infile(path + "NEWS");
std::string version;
std::ifstream infile(path + "version");
if (infile.is_open())
{
infile >> version;
if (!infile.fail())
return version;
}
else
{
infile.open(path + "NEWS");
while (infile)
{
infile >> version;
@@ -2737,6 +2746,7 @@ get_version(const std::string& path)
return version;
}
}
}
throw std::runtime_error("Unable to get Timezone database version from " + path);
}