Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:rhabacker:branches:windows:mingw:win32:Qt515
mingw32-libqt5-qtbase
0001-Use-unix-path-layout-on-Windows-too-to-mat...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Use-unix-path-layout-on-Windows-too-to-match-Framework.patch of Package mingw32-libqt5-qtbase
From 1dd8c076052b8ea565d0235133c4579cf70f50f9 Mon Sep 17 00:00:00 2001 From: Ralf Habacker <ralf.habacker@freenet.de> Date: Thu, 26 Jul 2018 15:23:27 +0200 Subject: [PATCH] Use unix path layout also on Windows to match KDE Frameworks build system path style Change-Id: Ic58f55b94a3457713c637034abdd9d0e88eccf51 ----- diff -ur a/src/corelib/io/io.pri b/src/corelib/io/io.pri --- a/src/corelib/io/io.pri 2021-11-16 07:41:20.000000000 +0100 +++ b/src/corelib/io/io.pri 2022-06-11 22:25:50.396658249 +0200 @@ -151,7 +151,7 @@ io/qwindowspipewriter_p.h SOURCES += \ - io/qstandardpaths_win.cpp \ + io/qstandardpaths_unix.cpp \ io/qstorageinfo_win.cpp \ io/qwindowspipereader.cpp \ io/qwindowspipewriter.cpp diff -ur a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp --- a/src/corelib/io/qstandardpaths_unix.cpp 2021-11-16 07:41:20.000000000 +0100 +++ b/src/corelib/io/qstandardpaths_unix.cpp 2022-06-11 22:28:18.618249694 +0200 @@ -49,6 +49,7 @@ #include <private/qfilesystemengine_p.h> #include <errno.h> #include <stdlib.h> +#include <qlibraryinfo.h> #ifndef QT_BOOTSTRAPPED #include <qcoreapplication.h> @@ -123,8 +124,18 @@ }; // http://standards.freedesktop.org/basedir-spec/latest/ +#ifdef Q_OS_WIN + const uint myUid = -2; +#else const uint myUid = uint(geteuid()); +#endif +#if !defined(Q_OS_WIN) || defined(QT_BOOTSTRAPPED) const QFile::Permissions wantedPerms = QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner; +#else + // since the current user is the owner, set both xxxUser and xxxOwner; added from Qt 5.11 + const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser + | QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner; +#endif const QFileSystemMetaData::MetaDataFlags statFlags = QFileSystemMetaData::PosixStatFlags | QFileSystemMetaData::LinkType; QFileSystemMetaData metaData; @@ -134,7 +145,11 @@ // A stat() before mkdir() that concluded it doesn't exist is a meaningless // result: we'd race against someone else attempting to create it. // ### QFileSystemEngine::createDirectory cannot take the extra mode argument. +#if !defined(Q_OS_WIN) || defined(QT_BOOTSTRAPPED) if (QT_MKDIR(entry.nativeFilePath(), 0700) == 0) +#else + if (QT_MKDIR(entry.nativeFilePath().toLocal8Bit().constData()) == 0) +#endif return true; if (errno != EEXIST) { qErrnoWarning("QStandardPaths: error creating runtime directory '%ls'", @@ -231,8 +246,12 @@ bool fromEnv = !xdgRuntimeDir.isEmpty(); if (xdgRuntimeDir.isEmpty() || !checkXdgRuntimeDir(xdgRuntimeDir)) { // environment variable not set or is set to something unsuitable +#ifdef Q_OS_WIN + const QString userName = QLatin1String(qgetenv("USERNAME")); +#else const uint myUid = uint(geteuid()); const QString userName = QFileSystemEngine::resolveUserName(myUid); +#endif xdgRuntimeDir = QDir::tempPath() + QLatin1String("/runtime-") + userName; if (!fromEnv) { @@ -351,23 +370,32 @@ return path; } - +#ifdef Q_OS_WIN + #define PathSeparator ';' +#else + #define PathSeparator ':' +#endif static QStringList xdgDataDirs() { QStringList dirs; // http://standards.freedesktop.org/basedir-spec/latest/ QString xdgDataDirsEnv = QFile::decodeName(qgetenv("XDG_DATA_DIRS")); if (xdgDataDirsEnv.isEmpty()) { +#ifdef Q_OS_WIN + QString prefix = QLibraryInfo::location(QLibraryInfo::PrefixPath); + dirs.append(prefix + QString::fromLatin1("/share")); +#else dirs.append(QString::fromLatin1("/usr/local/share")); dirs.append(QString::fromLatin1("/usr/share")); +#endif } else { - dirs = xdgDataDirsEnv.split(QLatin1Char(':'), QString::SkipEmptyParts); + dirs = xdgDataDirsEnv.split(QLatin1Char(PathSeparator), QString::SkipEmptyParts); // Normalize paths, skip relative paths QMutableListIterator<QString> it(dirs); while (it.hasNext()) { const QString dir = it.next(); - if (!dir.startsWith(QLatin1Char('/'))) + if (!QDir::isAbsolutePath(dir)) it.remove(); else it.setValue(QDir::cleanPath(dir)); @@ -389,10 +417,15 @@ QStringList dirs; // http://standards.freedesktop.org/basedir-spec/latest/ const QString xdgConfigDirs = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS")); - if (xdgConfigDirs.isEmpty()) + if (xdgConfigDirs.isEmpty()) { +#ifdef Q_OS_WIN + QString prefix = QLibraryInfo::location(QLibraryInfo::PrefixPath); + dirs.append(prefix + QString::fromLatin1("/etc/xdg")); +#else dirs.append(QString::fromLatin1("/etc/xdg")); - else - dirs = xdgConfigDirs.split(QLatin1Char(':')); +#endif + } else + dirs = xdgConfigDirs.split(QLatin1Char(PathSeparator)); return dirs; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor