Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Allow direct writes for storing resources

Carsten Hartenfels7ed2c96dfa48
diff --git a/libs/resources/KisStorageModel.cpp b/libs/resources/KisStorageModel.cpp
index bbed23f9e1..0e063f6285 100644
--- a/libs/resources/KisStorageModel.cpp
+++ b/libs/resources/KisStorageModel.cpp
@@ -469,7 +469,9 @@ bool KisStorageModel::importStorageInternal(const QString &filename,
QFile::copy(filename, newLocation);
} else {
QSaveFile f(newLocation);
- f.setDirectWriteFallback(false);
+ // If the user selects a custom resource location, atomic renames may
+ // not be available, so a direct write ends up being the only option.
+ f.setDirectWriteFallback(true);
if (!f.open(QIODevice::WriteOnly) || f.write(data) != data.size() || !f.flush()) {
qWarning() << "Error writing" << data.size() << "bytes to" << newLocation << "storage:" << f.errorString();