diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp index 6f9f47efceac8..a976d7db4a50f 100644 --- a/src/libsync/filesystem.cpp +++ b/src/libsync/filesystem.cpp @@ -199,8 +199,6 @@ bool FileSystem::getInode(const QString &filename, quint64 *inode) bool FileSystem::setFolderPermissions(const QString &path, FileSystem::FolderPermissions permissions) { - auto modified = false; - switch (permissions) { case OCC::FileSystem::FolderPermissions::ReadOnly: std::filesystem::permissions(path.toStdWString(), std::filesystem::perms::owner_write | std::filesystem::perms::group_write | std::filesystem::perms::others_write, std::filesystem::perm_options::remove); diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index f8cabf6bffde3..65e93e5f35f8e 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -680,7 +680,7 @@ void PropagateDownloadFile::startDownload() auto parentFolderStatus = std::filesystem::status(_parentFolderPath); _parentPermissions = parentFolderStatus.permissions(); if ((_parentPermissions & std::filesystem::perms::owner_write) != std::filesystem::perms::owner_write) { - FileSystem::setFolderPermissions(QString::fromStdWString(_parentFolderPath), FileSystem::FolderPermissions::ReadWrite); + FileSystem::setFolderPermissions(QString::fromStdWString(_parentFolderPath.wstring()), FileSystem::FolderPermissions::ReadWrite); emit propagator()->touchedFile(QString::fromStdWString(_parentFolderPath.wstring())); _needParentFolderRestorePermissions = true; } @@ -1292,7 +1292,7 @@ void PropagateDownloadFile::downloadFinished() if (_needParentFolderRestorePermissions) { try { - FileSystem::setFolderPermissions(QString::fromStdWString(_parentFolderPath), FileSystem::FolderPermissions::ReadWrite); + FileSystem::setFolderPermissions(QString::fromStdWString(_parentFolderPath.wstring()), FileSystem::FolderPermissions::ReadWrite); emit propagator()->touchedFile(QString::fromStdWString(_parentFolderPath.wstring())); _needParentFolderRestorePermissions = false; } diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index 0223d5988dda3..3135b82439ba2 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -130,7 +130,7 @@ void PropagateLocalRemove::start() } propagator()->reportProgress(*_item, 0); if (!propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->isDirectory())) { - qCWarning(lcPropagateLocalRename) << "could not delete file from local DB" << _item->_originalFile; + qCWarning(lcPropagateLocalRemove()) << "could not delete file from local DB" << _item->_originalFile; done(SyncFileItem::NormalError, tr("Could not delete file record %1 from local DB").arg(_item->_originalFile), ErrorCategory::GenericError); return; } @@ -193,14 +193,14 @@ void PropagateLocalMkdir::startLocalMkdir() auto parentFolderStatus = std::filesystem::status(parentFolderPath); parentPermissions = parentFolderStatus.permissions(); if ((parentPermissions & std::filesystem::perms::owner_write) != std::filesystem::perms::owner_write) { - FileSystem::setFolderPermissions(QString::fromStdWString(parentFolderPath), FileSystem::FolderPermissions::ReadWrite); + FileSystem::setFolderPermissions(QString::fromStdWString(parentFolderPath.wstring()), FileSystem::FolderPermissions::ReadWrite); parentNeedRollbackPermissions = true; emit propagator()->touchedFile(QString::fromStdWString(parentFolderPath.wstring())); } } catch (const std::filesystem::filesystem_error &e) { - qCWarning(lcPropagateLocalRename) << "exception when checking parent folder access rights" << e.what() << e.path1().c_str() << e.path2().c_str(); + qCWarning(lcPropagateLocalMkdir) << "exception when checking parent folder access rights" << e.what() << e.path1().c_str() << e.path2().c_str(); } emit propagator()->touchedFile(newDirStr); @@ -220,7 +220,7 @@ void PropagateLocalMkdir::startLocalMkdir() } catch (const std::filesystem::filesystem_error &e) { - qCWarning(lcPropagateLocalRename) << "exception when checking parent folder access rights" << e.what() << e.path1().c_str() << e.path2().c_str(); + qCWarning(lcPropagateLocalMkdir) << "exception when checking parent folder access rights" << e.what() << e.path1().c_str() << e.path2().c_str(); done(SyncFileItem::NormalError, tr("The folder %1 cannot be made read-only: %2").arg(_item->_file, e.what()), ErrorCategory::GenericError); return; } @@ -228,7 +228,7 @@ void PropagateLocalMkdir::startLocalMkdir() try { if (parentNeedRollbackPermissions) { - FileSystem::setFolderPermissions(QString::fromStdWString(parentFolderPath), FileSystem::FolderPermissions::ReadOnly); + FileSystem::setFolderPermissions(QString::fromStdWString(parentFolderPath.wstring()), FileSystem::FolderPermissions::ReadOnly); emit propagator()->touchedFile(QString::fromStdWString(parentFolderPath.wstring())); } } @@ -314,7 +314,7 @@ void PropagateLocalRename::start() auto parentFolderStatus = std::filesystem::status(targetParentFolderPath); targetParentPermissions = parentFolderStatus.permissions(); if ((targetParentPermissions & std::filesystem::perms::owner_write) != std::filesystem::perms::owner_write) { - FileSystem::setFolderPermissions(QString::fromStdWString(targetParentFolderPath), FileSystem::FolderPermissions::ReadWrite); + FileSystem::setFolderPermissions(QString::fromStdWString(targetParentFolderPath.wstring()), FileSystem::FolderPermissions::ReadWrite); emit propagator()->touchedFile(QString::fromStdWString(targetParentFolderPath.wstring())); } } @@ -332,7 +332,7 @@ void PropagateLocalRename::start() auto parentFolderStatus = std::filesystem::status(originParentFolderPath); originParentPermissions = parentFolderStatus.permissions(); if ((originParentPermissions & std::filesystem::perms::owner_write) != std::filesystem::perms::owner_write) { - FileSystem::setFolderPermissions(QString::fromStdWString(originParentFolderPath), FileSystem::FolderPermissions::ReadWrite); + FileSystem::setFolderPermissions(QString::fromStdWString(originParentFolderPath.wstring()), FileSystem::FolderPermissions::ReadWrite); emit propagator()->touchedFile(QString::fromStdWString(originParentFolderPath.wstring())); } } @@ -344,7 +344,7 @@ void PropagateLocalRename::start() const auto restoreTargetPermissions = [this] (const auto &parentFolderPath, const auto &parentPermissions) { try { if ((parentPermissions & std::filesystem::perms::owner_write) != std::filesystem::perms::owner_write) { - FileSystem::setFolderPermissions(QString::fromStdWString(parentFolderPath), FileSystem::FolderPermissions::ReadOnly); + FileSystem::setFolderPermissions(QString::fromStdWString(parentFolderPath.wstring()), FileSystem::FolderPermissions::ReadOnly); emit propagator()->touchedFile(QString::fromStdWString(parentFolderPath.wstring())); } }