Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Package not found: home:raulgs:gtk2_win/PUT_UPSTREAM_URL_HERE
home:raulgs:gtk2_win
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 2e767b8b2ab655314a8374bca2bf78cee01e20e8 Mon Sep 17 00:00:00 2001 From: Ralf Habacker <ralf.habacker@freenet.de> Date: Tue, 28 May 2024 16:17:24 +0200 Subject: [PATCH] Use unix path layout also on Windows to match KDE Frameworks build system path style Change-Id: Ic58f55b94a3457713c637034abdd9d0e88eccf51 --- src/corelib/io/io.pri | 2 +- src/corelib/io/qstandardpaths_unix.cpp | 28 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index a33ffe75f..6290331ce 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -154,7 +154,7 @@ win32 { io/qwindowspipewriter_p.h SOURCES += \ - io/qstandardpaths_win.cpp \ + io/qstandardpaths_unix.cpp \ io/qstorageinfo_win.cpp \ io/qwindowspipereader.cpp \ io/qwindowspipewriter.cpp diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index 4ebeefced..cc7ea588f 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -49,6 +49,7 @@ #include <private/qfilesystemengine_p.h> #include <errno.h> #include <stdlib.h> +#include <qlibraryinfo.h> #ifndef QT_BOOTSTRAPPED #include <qcoreapplication.h> @@ -145,8 +146,18 @@ static bool checkXdgRuntimeDir(const QString &xdgRuntimeDir) }; // 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; @@ -156,7 +167,11 @@ static bool checkXdgRuntimeDir(const QString &xdgRuntimeDir) // 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'", @@ -253,8 +268,12 @@ QString QStandardPaths::writableLocation(StandardLocation type) 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,14 +370,19 @@ static QStringList xdgDataDirs() // 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 { - const auto parts = xdgDataDirsEnv.splitRef(QLatin1Char(':'), Qt::SkipEmptyParts); + const auto parts = xdgDataDirsEnv.splitRef(QDir::listSeparator(), Qt::SkipEmptyParts); // Normalize paths, skip relative paths for (const QStringRef &dir : parts) { - if (dir.startsWith(QLatin1Char('/'))) + if (!QDir::isAbsolutePath(dir.toString())) dirs.push_back(QDir::cleanPath(dir.toString())); } -- 2.44.0
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