Warning, /graphics/krita/3rdparty/ext_frameworks/0001-Android-Fix-writing-to-config-if-path-is-a-content-U.patch is written in an unsupported language. File is not indexed.
0001 From 7db56e71e2595f04f9b103a7bb9a41d17003a1de Mon Sep 17 00:00:00 2001 0002 From: Sharaf Zaman <shzam@sdf.org> 0003 Date: Wed, 29 Sep 2021 05:58:12 +0000 0004 Subject: [PATCH] Android: Fix writing to config if path is a content:// Uri 0005 0006 --- 0007 src/core/kconfigini.cpp | 15 +++++++++++++-- 0008 1 file changed, 13 insertions(+), 2 deletions(-) 0009 0010 diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp 0011 index 798ce57..5a25e0f 100644 0012 --- a/src/core/kconfigini.cpp 0013 +++ b/src/core/kconfigini.cpp 0014 @@ -517,7 +517,7 @@ bool KConfigIniBackend::writeConfig(const QByteArray &locale, KEntryMap &entryMa 0015 } 0016 } else { 0017 // Open existing file. *DON'T* create it if it suddenly does not exist! 0018 -#ifdef Q_OS_UNIX 0019 +#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) 0020 int fd = QT_OPEN(QFile::encodeName(filePath()).constData(), O_WRONLY | O_TRUNC); 0021 if (fd < 0) { 0022 return false; 0023 @@ -629,7 +629,18 @@ bool KConfigIniBackend::lock() 0024 Q_ASSERT(!filePath().isEmpty()); 0025 0026 if (!lockFile) { 0027 - lockFile = new QLockFile(filePath() + QLatin1String(".lock")); 0028 +#ifdef Q_OS_ANDROID 0029 + // handle content Uris properly 0030 + if (filePath().startsWith(QLatin1String("content://"))) { 0031 + // we can't create file at an arbitrary location, so use internal storage to create one 0032 + lockFile = new QLockFile(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) 0033 + + QLatin1String("/") + QFileInfo(filePath()).fileName() + QLatin1String(".lock")); 0034 + } else { 0035 +#endif 0036 + lockFile = new QLockFile(filePath() + QLatin1String(".lock")); 0037 +#ifdef Q_OS_ANDROID 0038 + } 0039 +#endif 0040 } 0041 0042 lockFile->lock(); 0043 -- 0044 2.33.0 0045