mirror of
https://github.com/HowardHinnant/date.git
synced 2025-01-14 01:37:57 +08:00
Have get_version check for the file named version first
This commit is contained in:
parent
4a1c49152f
commit
2935f80109
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user