vfs: use native separators for displayed error message

i.e. `C:\Nextcloud` instead of `C:/Nextcloud`

Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
This commit is contained in:
Jyrki Gadinger 2025-02-18 09:49:09 +01:00
parent 0b31319c79
commit 7cdf15bea9

View File

@ -71,16 +71,17 @@ Result<void, QString> Vfs::checkAvailability(const QString &path, Vfs::Mode mode
#ifdef Q_OS_WIN
if (mode == Mode::WindowsCfApi) {
const auto info = QFileInfo(path);
const auto nativePath = QDir::toNativeSeparators(path);
if (QDir(info.canonicalFilePath()).isRoot()) {
return tr("Please choose a different location. %1 is a drive. It doesn't support virtual files.").arg(path);
return tr("Please choose a different location. %1 is a drive. It doesn't support virtual files.").arg(nativePath);
}
if (const auto fileSystemForPath = FileSystem::fileSystemForPath(info.absoluteFilePath());
fileSystemForPath != QLatin1String("NTFS")) {
return tr("Please choose a different location. %1 isn't a NTFS file system. It doesn't support virtual files.").arg(path);
return tr("Please choose a different location. %1 isn't a NTFS file system. It doesn't support virtual files.").arg(nativePath);
}
const auto type = GetDriveTypeW(reinterpret_cast<const wchar_t *>(QDir::toNativeSeparators(info.absoluteFilePath().mid(0, 3)).utf16()));
if (type == DRIVE_REMOTE) {
return tr("Please choose a different location. %1 is a network drive. It doesn't support virtual files.").arg(path);
return tr("Please choose a different location. %1 is a network drive. It doesn't support virtual files.").arg(nativePath);
}
}
#else