diff --git a/src/common/vfs.cpp b/src/common/vfs.cpp index ba5375680361c..71ff5dae02d48 100644 --- a/src/common/vfs.cpp +++ b/src/common/vfs.cpp @@ -75,7 +75,8 @@ Result Vfs::checkAvailability(const QString &path) } } #else - Q_UNUSED(path); + Q_UNUSED(mode) + Q_UNUSED(path) #endif return true; } @@ -149,26 +150,29 @@ Q_LOGGING_CATEGORY(lcPlugin, "plugins", QtInfoMsg) bool OCC::isVfsPluginAvailable(Vfs::Mode mode) { // TODO: cache plugins available? - if (mode == Vfs::Off) + if (mode == Vfs::Off) { return true; + } + auto name = modeToPluginName(mode); - if (name.isEmpty()) + if (name.isEmpty()) { return false; - auto pluginPath = pluginFileName(QStringLiteral("vfs"), name); - QPluginLoader loader(pluginPath); + } + + QPluginLoader loader(pluginFileName(QStringLiteral("vfs"), name)); - auto basemeta = loader.metaData(); - if (basemeta.isEmpty() || !basemeta.contains(QStringLiteral("IID"))) { + const auto baseMetaData = loader.metaData(); + if (baseMetaData.isEmpty() || !baseMetaData.contains(QStringLiteral("IID"))) { qCDebug(lcPlugin) << "Plugin doesn't exist" << loader.fileName(); return false; } - if (basemeta[QStringLiteral("IID")].toString() != QLatin1String("org.owncloud.PluginFactory")) { - qCWarning(lcPlugin) << "Plugin has wrong IID" << loader.fileName() << basemeta[QStringLiteral("IID")]; + if (baseMetaData[QStringLiteral("IID")].toString() != QStringLiteral("org.owncloud.PluginFactory")) { + qCWarning(lcPlugin) << "Plugin has wrong IID" << loader.fileName() << baseMetaData[QStringLiteral("IID")]; return false; } - auto metadata = basemeta[QStringLiteral("MetaData")].toObject(); - if (metadata[QStringLiteral("type")].toString() != QLatin1String("vfs")) { + const auto metadata = baseMetaData[QStringLiteral("MetaData")].toObject(); + if (metadata[QStringLiteral("type")].toString() != QStringLiteral("vfs")) { qCWarning(lcPlugin) << "Plugin has wrong type" << loader.fileName() << metadata[QStringLiteral("type")]; return false; } @@ -226,9 +230,11 @@ std::unique_ptr OCC::createVfsFromPlugin(Vfs::Mode mode) return std::unique_ptr(new VfsOff); auto name = modeToPluginName(mode); - if (name.isEmpty()) + if (name.isEmpty()) { return nullptr; - auto pluginPath = pluginFileName(QStringLiteral("vfs"), name); + } + + const auto pluginPath = pluginFileName(QStringLiteral("vfs"), name); if (!isVfsPluginAvailable(mode)) { qCCritical(lcPlugin) << "Could not load plugin: not existant or bad metadata" << pluginPath; diff --git a/src/libsync/vfs/cfapi/CMakeLists.txt b/src/libsync/vfs/cfapi/CMakeLists.txt index 13f48769f82c1..77392c21f96d5 100644 --- a/src/libsync/vfs/cfapi/CMakeLists.txt +++ b/src/libsync/vfs/cfapi/CMakeLists.txt @@ -21,19 +21,7 @@ if (WIN32) target_include_directories("${synclib_NAME}_vfs_cfapi" BEFORE PUBLIC ${CMAKE_CURRENT_BINARY_DIR} INTERFACE ${CMAKE_BINARY_DIR}) - if(APPLE) - # for being loadable when client run from build dir - set(vfs_buildoutputdir "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns/") - set_target_properties("${synclib_NAME}_vfs_cfapi" - PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${vfs_buildoutputdir} - RUNTIME_OUTPUT_DIRECTORY ${vfs_buildoutputdir} - ) - # For being lodable when client run from install dir (after make macdeployqt) - set(vfs_installdir "${LIB_INSTALL_DIR}/../PlugIns") - else() - set(vfs_installdir "${PLUGINDIR}") - endif() + set(vfs_installdir "${PLUGINDIR}") GENERATE_EXPORT_HEADER( "${synclib_NAME}_vfs_cfapi" BASE_NAME "${synclib_NAME}_vfs_cfapi" diff --git a/src/libsync/vfs/cfapi/vfs_cfapi.cpp b/src/libsync/vfs/cfapi/vfs_cfapi.cpp index 3d8e18d9a0b79..b28b7cefe0ee2 100644 --- a/src/libsync/vfs/cfapi/vfs_cfapi.cpp +++ b/src/libsync/vfs/cfapi/vfs_cfapi.cpp @@ -114,7 +114,7 @@ Result VfsCfApi::updateMetadata(const QString &filePath, time_t m return cfapi::updatePlaceholderInfo(handle, modtime, size, fileId); } else { qCWarning(lcCfApi) << "Couldn't update metadata for non existing file" << localPath; - return {"Couldn't update metadata"}; + return { "Couldn't update metadata" }; } } diff --git a/src/libsync/vfs/suffix/CMakeLists.txt b/src/libsync/vfs/suffix/CMakeLists.txt index 3765e02855145..92426a5fb9dd5 100644 --- a/src/libsync/vfs/suffix/CMakeLists.txt +++ b/src/libsync/vfs/suffix/CMakeLists.txt @@ -21,7 +21,7 @@ if(APPLE) LIBRARY_OUTPUT_DIRECTORY ${vfs_buildoutputdir} RUNTIME_OUTPUT_DIRECTORY ${vfs_buildoutputdir} ) - # For being lodable when client run from install dir (after make macdeployqt) + # For being loadable when client run from install dir (after make macdeployqt) set(vfs_installdir "${LIB_INSTALL_DIR}/../PlugIns") else() set(vfs_installdir "${PLUGINDIR}") diff --git a/src/libsync/vfs/xattr/CMakeLists.txt b/src/libsync/vfs/xattr/CMakeLists.txt index f7dc4a45c2b8f..0eedd7da7c6a9 100644 --- a/src/libsync/vfs/xattr/CMakeLists.txt +++ b/src/libsync/vfs/xattr/CMakeLists.txt @@ -31,7 +31,7 @@ if (UNIX) LIBRARY_OUTPUT_DIRECTORY ${vfs_buildoutputdir} RUNTIME_OUTPUT_DIRECTORY ${vfs_buildoutputdir} ) - # For being lodable when client run from install dir (after make macdeployqt) + # For being loadable when client run from install dir (after make macdeployqt) set(vfs_installdir "${LIB_INSTALL_DIR}/../PlugIns") else() set(vfs_installdir "${PLUGINDIR}")