mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-04 13:14:26 +02:00
Have get_version check for the file named version first
This commit is contained in:
12
tz.cpp
12
tz.cpp
@@ -2726,8 +2726,17 @@ static
|
|||||||
std::string
|
std::string
|
||||||
get_version(const std::string& path)
|
get_version(const std::string& path)
|
||||||
{
|
{
|
||||||
std::ifstream infile(path + "NEWS");
|
|
||||||
std::string version;
|
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)
|
while (infile)
|
||||||
{
|
{
|
||||||
infile >> version;
|
infile >> version;
|
||||||
@@ -2737,6 +2746,7 @@ get_version(const std::string& path)
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
throw std::runtime_error("Unable to get Timezone database version from " + path);
|
throw std::runtime_error("Unable to get Timezone database version from " + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user