From 23f0208d3357af59606274b225ed65dfc1763149 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 26 Jun 2024 17:03:03 +0800 Subject: [PATCH] Do not re-generate standard string path twice Signed-off-by: Claudio Cambra --- src/libsync/filesystem.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp index 1d56cbdd83653..238c83eb41555 100644 --- a/src/libsync/filesystem.cpp +++ b/src/libsync/filesystem.cpp @@ -319,10 +319,11 @@ bool FileSystem::setFolderPermissions(const QString &path, FileSystem::FolderPermissions permissions) noexcept { static constexpr auto writePerms = std::filesystem::perms::owner_write | std::filesystem::perms::group_write | std::filesystem::perms::others_write; + const auto stdStrPath = path.toStdWString(); try { switch (permissions) { case OCC::FileSystem::FolderPermissions::ReadOnly: - std::filesystem::permissions(path.toStdWString(), writePerms, std::filesystem::perm_options::remove); + std::filesystem::permissions(stdStrPath, writePerms, std::filesystem::perm_options::remove); break; case OCC::FileSystem::FolderPermissions::ReadWrite: break; @@ -458,7 +459,7 @@ bool FileSystem::setFolderPermissions(const QString &path, case OCC::FileSystem::FolderPermissions::ReadOnly: break; case OCC::FileSystem::FolderPermissions::ReadWrite: - std::filesystem::permissions(path.toStdWString(), writePerms, std::filesystem::perm_options::add); + std::filesystem::permissions(stdStrPath, writePerms, std::filesystem::perm_options::add); break; } }