forked from qt-creator/qt-creator
Small tweaks to NTFS writable check fix
This commit is contained in:
@@ -1173,9 +1173,8 @@ bool EditorManager::saveFile(IEditor *editor)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (file->isReadOnly() || fileName.isEmpty()) {
|
||||
if (file->isReadOnly() || fileName.isEmpty())
|
||||
return saveFileAs(editor);
|
||||
}
|
||||
|
||||
m_d->m_core->fileManager()->blockFileChange(file);
|
||||
const bool success = file->save(fileName);
|
||||
|
@@ -146,15 +146,14 @@ bool BaseTextDocument::isReadOnly() const
|
||||
const QFileInfo fi(m_fileName);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
// be careful when getting info from files on network drives
|
||||
int old_ntfs_permission_lookup = qt_ntfs_permission_lookup;
|
||||
qt_ntfs_permission_lookup = 1;
|
||||
// Check for permissions on NTFS file systems
|
||||
qt_ntfs_permission_lookup++;
|
||||
#endif
|
||||
|
||||
const int ro = !fi.isWritable();
|
||||
const bool ro = !fi.isWritable();
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
qt_ntfs_permission_lookup = old_ntfs_permission_lookup;
|
||||
qt_ntfs_permission_lookup--;
|
||||
#endif
|
||||
return ro;
|
||||
}
|
||||
@@ -175,9 +174,6 @@ bool BaseTextDocument::open(const QString &fileName)
|
||||
if (!file.exists())
|
||||
return false;
|
||||
|
||||
if (!fi.isReadable())
|
||||
return false;
|
||||
|
||||
if (!file.open(QIODevice::ReadWrite) && !file.open(QIODevice::ReadOnly))
|
||||
return false;
|
||||
|
||||
|
Reference in New Issue
Block a user