Avoid trying to create autosave files in read-only directories

Task-number: QTCREATORBUG-10958
Change-Id: I9cb4289f35f194bcbb5e242f064c67264bcf8676
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-08-10 14:15:01 +02:00
parent ad5b6e60b5
commit c9614cb5f7

View File

@@ -1774,10 +1774,13 @@ void EditorManagerPrivate::autoSave()
foreach (IDocument *document, DocumentModel::openedDocuments()) {
if (!document->isModified() || !document->shouldAutoSave())
continue;
if (document->filePath().isEmpty()) // FIXME: save them to a dedicated directory
const QString saveName = autoSaveName(document->filePath().toString());
const QString savePath = QFileInfo(saveName).absolutePath();
if (document->filePath().isEmpty()
|| !QFileInfo(savePath).isWritable()) // FIXME: save them to a dedicated directory
continue;
QString errorString;
if (!document->autoSave(&errorString, autoSaveName(document->filePath().toString())))
if (!document->autoSave(&errorString, saveName))
errors << errorString;
}
if (!errors.isEmpty())