diff --git a/src/corelib/io/qstorageinfo_linux_p.h b/src/corelib/io/qstorageinfo_linux_p.h index ae6c1a38592..f548f77446b 100644 --- a/src/corelib/io/qstorageinfo_linux_p.h +++ b/src/corelib/io/qstorageinfo_linux_p.h @@ -215,7 +215,8 @@ doParseMountInfo(const QByteArray &mountinfo, FilterMountInfo filter = FilterMou continue; info.fsType = fields[FsType].toByteArray(); - if (filter == FilterMountInfo::Filtered && !shouldIncludeFs(info.mountPoint, info.fsType)) + if (filter == FilterMountInfo::Filtered + && !QStorageInfoPrivate::shouldIncludeFs(info.mountPoint, info.fsType)) continue; std::optional devno = deviceNumber(fields[DevNo]); diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h index 3b049cdfd47..d4c45954ffb 100644 --- a/src/corelib/io/qstorageinfo_p.h +++ b/src/corelib/io/qstorageinfo_p.h @@ -90,6 +90,18 @@ class QStorageInfoPrivate : public QSharedData void retrieveVolumeInfo(); #endif +#ifdef Q_OS_UNIX + // Common helper functions + template + static bool isParentOf(const String &parent, const QString &dirName) + { + return dirName.startsWith(parent) && + (dirName.size() == parent.size() || dirName.at(parent.size()) == u'/' || + parent.size() == 1); + } + static inline bool shouldIncludeFs(const QString &mountDir, const QByteArray &fsType); +#endif + public: QString rootPath; QByteArray device; @@ -107,16 +119,8 @@ class QStorageInfoPrivate : public QSharedData bool valid = false; }; -// Common helper functions -template -static bool isParentOf(const String &parent, const QString &dirName) -{ - return dirName.startsWith(parent) && - (dirName.size() == parent.size() || dirName.at(parent.size()) == u'/' || - parent.size() == 1); -} - -static inline bool shouldIncludeFs(const QString &mountDir, const QByteArray &fsType) +#ifdef Q_OS_UNIX +bool QStorageInfoPrivate::shouldIncludeFs(const QString &mountDir, const QByteArray &fsType) { #if defined(Q_OS_ANDROID) // "rootfs" is the filesystem type of "/" on Android @@ -158,6 +162,7 @@ static inline bool shouldIncludeFs(const QString &mountDir, const QByteArray &fs // size checking in QStorageInfo::mountedVolumes() return true; } +#endif // Q_OS_UNIX QT_END_NAMESPACE