Skip to content

Commit

Permalink
Have get_version check for the file named version first
Browse files Browse the repository at this point in the history
  • Loading branch information
HowardHinnant committed Jan 1, 2017
1 parent 4a1c491 commit 2935f80
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2726,15 +2726,25 @@ static
std::string
get_version(const std::string& path)
{
std::ifstream infile(path + "NEWS");
std::string version;
while (infile)
std::ifstream infile(path + "version");
if (infile.is_open())
{
infile >> version;
if (version == "Release")
if (!infile.fail())
return version;
}
else
{
infile.open(path + "NEWS");
while (infile)
{
infile >> version;
return version;
if (version == "Release")
{
infile >> version;
return version;
}
}
}
throw std::runtime_error("Unable to get Timezone database version from " + path);
Expand Down

0 comments on commit 2935f80

Please sign in to comment.