1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00
nixpkgs/pkgs/development/libraries/qt-5/qt-5.3-tzdir.patch
2014-11-20 11:14:15 -06:00

41 lines
1.9 KiB
Diff

diff --git a/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp b/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
index b4ea91e..a56a245 100644
--- a/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -68,7 +68,10 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
// 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");
+ QString path = qgetenv("TZDIR");
+ path += "/zone.tab";
+ if (!QFile::exists(path))
+ path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
if (!QFile::exists(path))
path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
@@ -559,12 +562,18 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
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));
+ // Try TZDIR first
+ QString zoneinfoDir = qgetenv("TZDIR");
+ zoneinfoDir += "/" + QString::fromLocal8Bit(ianaId);
+ tzif.setFileName(zoneinfoDir);
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;
+ }
}
}