From 844f77a249f916b3b945ef0484a487c98d5baa24 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Thu, 20 May 2021 16:45:52 +0200 Subject: [PATCH] Fix network drive detection We can't rely on the file system detection because Windows is reporting the underlying file system. Fixes: #8272 --- src/common/vfs.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/vfs.cpp b/src/common/vfs.cpp index e887937f0..84df80c76 100644 --- a/src/common/vfs.cpp +++ b/src/common/vfs.cpp @@ -70,10 +70,18 @@ Result Vfs::checkAvailability(const QString &path) const auto mode = bestAvailableVfsMode(); #ifdef Q_OS_WIN if (mode == Mode::WindowsCfApi) { - const auto fs = FileSystem::fileSystemForPath(path); + const auto info = QFileInfo(path); + if (QDir(info.canonicalPath()).isRoot()) { + return tr("The Virtual filesystem feature does not support a drive as sync root"); + } + const auto fs = FileSystem::fileSystemForPath(info.absoluteFilePath()); if (fs != QLatin1String("NTFS")) { return tr("The Virtual filesystem feature requires a NTFS file system, %1 is using %2").arg(path, fs); } + const auto type = GetDriveTypeW(reinterpret_cast(QDir::toNativeSeparators(info.absoluteFilePath().mid(0, 3)).utf16())); + if (type == DRIVE_REMOTE) { + return tr("The Virtual filesystem feature is not supported on network drives"); + } } #else Q_UNUSED(mode) -- 2.30.2