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.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
|
||||||
+++ qtbase-opensource-src-5.8.0/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
|
// Parse zone.tab table, assume lists all installed zones, if not will need to read directories
|
||||||
static QTzTimeZoneHash loadTzTimeZones()
|
static QTzTimeZoneHash loadTzTimeZones()
|
||||||
{
|
{
|
||||||
- QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
- QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
||||||
+ QString path = qgetenv("TZDIR");
|
+ // Try TZDIR first, in case we're running on NixOS.
|
||||||
+ path += "/zone.tab";
|
+ QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
|
||||||
|
+ // Fallback to traditional paths in case we are not on NixOS.
|
||||||
+ if (!QFile::exists(path))
|
+ if (!QFile::exists(path))
|
||||||
+ path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
+ path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
||||||
if (!QFile::exists(path))
|
if (!QFile::exists(path))
|
||||||
path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
|
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))
|
if (!tzif.open(QIODevice::ReadOnly))
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
- // Open named tz, try modern path first, if fails try legacy path
|
- // Open named tz, try modern path first, if fails try legacy path
|
||||||
- tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
- tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
||||||
+ // Try TZDIR first
|
+ // Try TZDIR first, in case we're running on NixOS
|
||||||
+ QString zoneinfoDir = qgetenv("TZDIR");
|
+ tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
|
||||||
+ zoneinfoDir += "/" + QString::fromLocal8Bit(ianaId);
|
|
||||||
+ tzif.setFileName(zoneinfoDir);
|
|
||||||
if (!tzif.open(QIODevice::ReadOnly)) {
|
if (!tzif.open(QIODevice::ReadOnly)) {
|
||||||
- tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
- tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
||||||
- if (!tzif.open(QIODevice::ReadOnly))
|
- if (!tzif.open(QIODevice::ReadOnly))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user