return formatWinError(GetLastError());
};
+ class OCSYNC_EXPORT NtfsPermissionLookupRAII
+ {
+ public:
+ /**
+ * NTFS permissions lookup is diabled by default for performance reasons
+ * Enable it and disable it again once we leave the scope
+ * https://doc.qt.io/Qt-5/qfileinfo.html#ntfs-permissions
+ */
+ NtfsPermissionLookupRAII();
+ ~NtfsPermissionLookupRAII();
+
+ private:
+ Q_DISABLE_COPY(NtfsPermissionLookupRAII);
+ };
+
#endif
}
/** @} */ // \addtogroup
#include <QLibrary>
+extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
+
static const char systemRunPathC[] = R"(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run)";
static const char runPathC[] = R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)";
return QStringLiteral("WindowsError: %1: %2").arg(QString::number(errorCode, 16), QString::fromWCharArray(_com_error(errorCode).ErrorMessage()));
}
+
+Utility::NtfsPermissionLookupRAII::NtfsPermissionLookupRAII()
+{
+ qt_ntfs_permission_lookup++;
+}
+
+Utility::NtfsPermissionLookupRAII::~NtfsPermissionLookupRAII()
+{
+ qt_ntfs_permission_lookup--;
+}
+
} // namespace OCC
return FolderMan::tr("No valid folder selected!");
}
- QFileInfo selFile(path);
+#ifdef Q_OS_WIN
+ Utility::NtfsPermissionLookupRAII ntfs_perm;
+#endif
+ const QFileInfo selFile(path);
if (!selFile.exists()) {
QString parentPath = selFile.dir().path();