Fix issue in VAbstractMainWindow::CheckFilePermissions.
Don't check permissions if file doesn't exist.
This commit is contained in:
parent
09005ddb63
commit
84cf53f612
|
@ -252,14 +252,24 @@ void VAbstractMainWindow::UpdateRecentFileActions()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractMainWindow::CheckFilePermissions(const QString &path, QWidget *messageBoxParent) -> bool
|
auto VAbstractMainWindow::CheckFilePermissions(const QString &path, QWidget *messageBoxParent) -> bool
|
||||||
{
|
{
|
||||||
|
QFileInfo info(path);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
qt_ntfs_permission_lookup++; // turn checking on
|
qt_ntfs_permission_lookup++; // turn checking on
|
||||||
#endif /*Q_OS_WIN32*/
|
#endif /*Q_OS_WIN32*/
|
||||||
|
|
||||||
|
if (not info.exists())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// cppcheck-suppress unreadVariable
|
// cppcheck-suppress unreadVariable
|
||||||
const bool isFileWritable = QFileInfo(path).isWritable();
|
const bool isFileWritable = info.isWritable();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
qt_ntfs_permission_lookup--; // turn it off again
|
qt_ntfs_permission_lookup--; // turn it off again
|
||||||
#endif /*Q_OS_WIN32*/
|
#endif /*Q_OS_WIN32*/
|
||||||
|
|
||||||
if (not isFileWritable)
|
if (not isFileWritable)
|
||||||
{
|
{
|
||||||
QMessageBox messageBox(messageBoxParent);
|
QMessageBox messageBox(messageBoxParent);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user