2017-06-17 17:26:19 +01:00
|
|
|
Index: qtbase-opensource-src-5.9.0/src/corelib/tools/qtimezoneprivate_tz.cpp
|
2017-02-28 15:37:57 +00:00
|
|
|
===================================================================
|
2017-06-17 17:26:19 +01:00
|
|
|
--- qtbase-opensource-src-5.9.0.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
|
|
|
|
+++ qtbase-opensource-src-5.9.0/src/corelib/tools/qtimezoneprivate_tz.cpp
|
2017-04-25 12:05:45 +01:00
|
|
|
@@ -70,7 +70,11 @@ typedef QHash<QByteArray, QTzTimeZone> Q
|
2017-02-28 15:37:57 +00:00
|
|
|
// Parse zone.tab table, assume lists all installed zones, if not will need to read directories
|
|
|
|
static QTzTimeZoneHash loadTzTimeZones()
|
|
|
|
{
|
|
|
|
- QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
2017-04-25 12:05:45 +01:00
|
|
|
+ // Try TZDIR first, in case we're running on NixOS.
|
|
|
|
+ QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
|
|
|
|
+ // Fallback to traditional paths in case we are not on NixOS.
|
2017-02-28 15:37:57 +00:00
|
|
|
+ if (!QFile::exists(path))
|
|
|
|
+ path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
|
|
|
if (!QFile::exists(path))
|
|
|
|
path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
|
|
|
|
|
2017-06-17 17:26:19 +01:00
|
|
|
@@ -643,12 +647,16 @@ void QTzTimeZonePrivate::init(const QByt
|
2017-02-28 15:37:57 +00:00
|
|
|
if (!tzif.open(QIODevice::ReadOnly))
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
- // Open named tz, try modern path first, if fails try legacy path
|
|
|
|
- tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
2017-04-25 12:05:45 +01:00
|
|
|
+ // Try TZDIR first, in case we're running on NixOS
|
|
|
|
+ tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
|
2017-02-28 15:37:57 +00:00
|
|
|
if (!tzif.open(QIODevice::ReadOnly)) {
|
|
|
|
- tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
|
|
|
- if (!tzif.open(QIODevice::ReadOnly))
|
|
|
|
- return;
|
|
|
|
+ // Open named tz, try modern path first, if fails try legacy path
|
|
|
|
+ tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
|
|
|
+ if (!tzif.open(QIODevice::ReadOnly)) {
|
|
|
|
+ tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
|
|
|
+ if (!tzif.open(QIODevice::ReadOnly))
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|