Fix issue in VAbstractMainWindow::CheckFilePermissions.

Don't check permissions if file doesn't exist.
This commit is contained in:
Roman Telezhynskyi 2021-09-08 12:53:15 +03:00
parent 09005ddb63
commit 84cf53f612

View File

@ -252,14 +252,24 @@ void VAbstractMainWindow::UpdateRecentFileActions()
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractMainWindow::CheckFilePermissions(const QString &path, QWidget *messageBoxParent) -> bool
{
QFileInfo info(path);
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/
if (not info.exists())
{
return true;
}
// cppcheck-suppress unreadVariable
const bool isFileWritable = QFileInfo(path).isWritable();
const bool isFileWritable = info.isWritable();
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/
if (not isFileWritable)
{
QMessageBox messageBox(messageBoxParent);