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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->isReadOnly() || fileName.isEmpty()) {
|
if (file->isReadOnly() || fileName.isEmpty())
|
||||||
return saveFileAs(editor);
|
return saveFileAs(editor);
|
||||||
}
|
|
||||||
|
|
||||||
m_d->m_core->fileManager()->blockFileChange(file);
|
m_d->m_core->fileManager()->blockFileChange(file);
|
||||||
const bool success = file->save(fileName);
|
const bool success = file->save(fileName);
|
||||||
|
@@ -146,15 +146,14 @@ bool BaseTextDocument::isReadOnly() const
|
|||||||
const QFileInfo fi(m_fileName);
|
const QFileInfo fi(m_fileName);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
// be careful when getting info from files on network drives
|
// Check for permissions on NTFS file systems
|
||||||
int old_ntfs_permission_lookup = qt_ntfs_permission_lookup;
|
qt_ntfs_permission_lookup++;
|
||||||
qt_ntfs_permission_lookup = 1;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int ro = !fi.isWritable();
|
const bool ro = !fi.isWritable();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
qt_ntfs_permission_lookup = old_ntfs_permission_lookup;
|
qt_ntfs_permission_lookup--;
|
||||||
#endif
|
#endif
|
||||||
return ro;
|
return ro;
|
||||||
}
|
}
|
||||||
@@ -175,9 +174,6 @@ bool BaseTextDocument::open(const QString &fileName)
|
|||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!fi.isReadable())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadWrite) && !file.open(QIODevice::ReadOnly))
|
if (!file.open(QIODevice::ReadWrite) && !file.open(QIODevice::ReadOnly))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user