forked from qt-creator/qt-creator
Fix "save as" with same file path, involving symbolic links
We close all existing documents for the new file path, before renaming the current document, but may not close the current document itself. We already tried to prevent that, but didn't take symbolic links into account (which could also involve directories that are symbolic links). Use the same logic for determining if the two files are "the same" as in DocumentModel::documentForFilePath. Fixes: QTCREATORBUG-27741 Change-Id: I3f3984f1f761328ee373b34870e03a9fce30c190 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2533,7 +2533,8 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
|
||||
if (absoluteFilePath.isEmpty())
|
||||
return false;
|
||||
|
||||
if (absoluteFilePath != document->filePath()) {
|
||||
if (DocumentManager::filePathKey(absoluteFilePath, DocumentManager::ResolveLinks)
|
||||
!= DocumentManager::filePathKey(document->filePath(), DocumentManager::ResolveLinks)) {
|
||||
// close existing editors for the new file name
|
||||
IDocument *otherDocument = DocumentModel::documentForFilePath(absoluteFilePath);
|
||||
if (otherDocument)
|
||||
|
Reference in New Issue
Block a user