mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-25 21:44:49 +00:00
qt58.qtbase: fix warnings in TZDIR patch
This commit is contained in:
parent
64418af8c5
commit
9f00e2be18
@ -2,28 +2,27 @@ Index: qtbase-opensource-src-5.8.0/src/corelib/tools/qtimezoneprivate_tz.cpp
|
||||
===================================================================
|
||||
--- qtbase-opensource-src-5.8.0.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
|
||||
+++ qtbase-opensource-src-5.8.0/src/corelib/tools/qtimezoneprivate_tz.cpp
|
||||
@@ -70,7 +70,10 @@ typedef QHash<QByteArray, QTzTimeZone> Q
|
||||
@@ -70,7 +70,11 @@ typedef QHash<QByteArray, QTzTimeZone> Q
|
||||
// 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";
|
||||
+ // 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.
|
||||
+ if (!QFile::exists(path))
|
||||
+ path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
||||
if (!QFile::exists(path))
|
||||
path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
|
||||
|
||||
@@ -642,12 +645,18 @@ void QTzTimeZonePrivate::init(const QByt
|
||||
@@ -642,12 +646,16 @@ void QTzTimeZonePrivate::init(const QByt
|
||||
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);
|
||||
+ // Try TZDIR first, in case we're running on NixOS
|
||||
+ tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
|
||||
if (!tzif.open(QIODevice::ReadOnly)) {
|
||||
- tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
||||
- if (!tzif.open(QIODevice::ReadOnly))
|
||||
|
Loading…
Reference in New Issue
Block a user