diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-05-20 17:45:52 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-05-20 18:48:28 +0300 |
commit | 81db09d08263b16b5893829255628ee4d11c0b8b (patch) | |
tree | 5243b0f9b058e1be7065aec5cb32e14b35441bb4 /src | |
parent | b248e2a7b665139e0752a776c232c1a59407603e (diff) |
Fix network drive detection
We can't rely on the file system detection because Windows is reporting the underlying file system.
Fixes: #8272
Diffstat (limited to 'src')
-rw-r--r-- | src/common/vfs.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/common/vfs.cpp b/src/common/vfs.cpp index d36caf093..b17417ad5 100644 --- a/src/common/vfs.cpp +++ b/src/common/vfs.cpp @@ -68,13 +68,18 @@ Result<bool, QString> Vfs::checkAvailability(const QString &path) const auto mode = bestAvailableVfsMode(); #ifdef Q_OS_WIN if (mode == Mode::WindowsCfApi) { - if (QDir(QDir(path).canonicalPath()).isRoot()) { + 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(path); + 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<const wchar_t *>(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(path); |