diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2020-10-21 13:31:21 +0300 |
---|---|---|
committer | Kevin Ottens <kevin.ottens@nextcloud.com> | 2020-12-15 12:59:20 +0300 |
commit | dd3e70b66762abc611ecb4c2715eef9bfea0eb09 (patch) | |
tree | 5a48a5dc0495c55ca87c4eba120aaed2821782f8 /src/common | |
parent | 8796f25994b03533fff334f35a297fc293f81575 (diff) |
VirtualFiles: Ensure the target location supports vfs
Fixes: #8131
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/vfs.cpp | 18 | ||||
-rw-r--r-- | src/common/vfs.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/common/vfs.cpp b/src/common/vfs.cpp index d97ea69cc..8c5c53d7b 100644 --- a/src/common/vfs.cpp +++ b/src/common/vfs.cpp @@ -21,6 +21,8 @@ #include "version.h" #include "syncjournaldb.h" +#include "common/filesystembase.h" + #include <QPluginLoader> #include <QLoggingCategory> @@ -60,6 +62,22 @@ Optional<Vfs::Mode> Vfs::modeFromString(const QString &str) return {}; } +Result<bool, QString> Vfs::checkAvailability(const QString &path) +{ + const auto mode = bestAvailableVfsMode(); +#ifdef Q_OS_WIN + if (mode == Mode::WindowsCfApi) { + const auto fs = FileSystem::fileSystemForPath(path); + if (fs != QLatin1String("NTFS")) { + return tr("The Virtual filesystem feature requires a NTFS file system, %1 is using %2").arg(path, fs); + } + } +#else + Q_UNUSED(path); +#endif + return true; +} + void Vfs::start(const VfsSetupParams ¶ms) { _setupParams = params; diff --git a/src/common/vfs.h b/src/common/vfs.h index 3e17a17f9..c11f59bb2 100644 --- a/src/common/vfs.h +++ b/src/common/vfs.h @@ -99,6 +99,8 @@ public: static QString modeToString(Mode mode); static Optional<Mode> modeFromString(const QString &str); + static Result<bool, QString> checkAvailability(const QString &path); + enum class AvailabilityError { // Availability can't be retrieved due to db error |