diff --git a/src/engine/fsutils.cpp b/src/engine/fsutils.cpp --- a/src/engine/fsutils.cpp +++ b/src/engine/fsutils.cpp @@ -23,8 +23,9 @@ #include "fsutils.h" #include +#include -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) #include #include #include @@ -36,34 +37,8 @@ QString FSUtils::getDirectoryFileSystem(const QString &directory) { -#ifndef Q_OS_LINUX - return QString(); -#else - QString bestMatchPath; - QString bestMatchFS; - - FILE *mtab = setmntent("/etc/mtab", "r"); - if (!mtab) { - return QString(); - } - while (mntent *mnt = getmntent(mtab)) { - if (qstrcmp(mnt->mnt_type, MNTTYPE_IGNORE) == 0) { - continue; - } - - const QString dir = QString::fromLocal8Bit(mnt->mnt_dir); - if (!directory.startsWith(dir) || dir.length() < bestMatchPath.length()) { - continue; - } - - bestMatchPath = dir; - bestMatchFS = QString::fromLocal8Bit(mnt->mnt_type); - } - - endmntent(mtab); - - return bestMatchFS; -#endif + QStorageInfo storageInfo(directory); + return storageInfo.fileSystemType(); } void FSUtils::disableCoW(const QString &path)