Vfs: Ensure older versions gracefully ignore winvfs folders

Previously there'd likely be a mess if a 2.6 winvfs folder was attempted
to be used with a 2.5 client. Now the older clients will ignore these
folders.
This commit is contained in:
Christian Kamm 2018-12-18 10:47:45 +01:00 committed by Kevin Ottens
parent bdfda460e6
commit 75b9976526
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
2 changed files with 14 additions and 3 deletions

View file

@ -1247,11 +1247,16 @@ void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder)
settings.setValue(QLatin1String("targetPath"), folder.targetPath);
settings.setValue(QLatin1String("paused"), folder.paused);
settings.setValue(QLatin1String("ignoreHiddenFiles"), folder.ignoreHiddenFiles);
settings.setValue(QLatin1String(versionC), maxSettingsVersion());
settings.setValue(QLatin1String("usePlaceholders"), folder.newFilesAreVirtual);
settings.setValue(QStringLiteral("virtualFilesMode"), Vfs::modeToString(folder.virtualFilesMode));
// Ensure new vfs modes won't be attempted by older clients
if (folder.virtualFilesMode == Vfs::WindowsCfApi) {
settings.setValue(QLatin1String(versionC), 3);
} else {
settings.setValue(QLatin1String(versionC), 2);
}
// Happens only on Windows when the explorer integration is enabled.
if (!folder.navigationPaneClsid.isNull())

View file

@ -78,8 +78,14 @@ public:
static bool load(QSettings &settings, const QString &alias,
FolderDefinition *folder);
/// The highest version in the settings that load() can read
static int maxSettingsVersion() { return 2; }
/** The highest version in the settings that load() can read
*
* Version 1: initial version (default if value absent in settings)
* Version 2: introduction of metadata_parent hash in 2.6.0
* (version remains readable by 2.5.1)
* Version 3: introduction of new windows vfs mode in 2.6.0
*/
static int maxSettingsVersion() { return 3; }
/// Ensure / as separator and trailing /.
static QString prepareLocalPath(const QString &path);