forked from HowardHinnant/date
Have get_version check for the file named version first
This commit is contained in:
18
tz.cpp
18
tz.cpp
@@ -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);
|
||||
|
Reference in New Issue
Block a user