Skip to content

Commit 7504eae

Browse files
committed
Call setPinState with relative path and expand that in there
Keep compatibility with the interface semantics.
1 parent 3c1d118 commit 7504eae

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/gui/socketapi/socketapi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ void SocketApi::command_MAKE_AVAILABLE_LOCALLY(const QString &filesArg, SocketLi
568568
continue;
569569

570570
// Update the pin state on all items
571-
std::ignore = data.folder->vfs().setPinState(data.localPath, PinState::AlwaysLocal);
571+
std::ignore = data.folder->vfs().setPinState(data.folderRelativePath, PinState::AlwaysLocal);
572572

573573
// Trigger sync
574574
data.folder->schedulePathForLocalDiscovery(data.folderRelativePath);
@@ -587,7 +587,7 @@ void SocketApi::command_MAKE_ONLINE_ONLY(const QString &filesArg, SocketListener
587587
continue;
588588

589589
// Update the pin state on all items
590-
std::ignore = data.folder->vfs().setPinState(data.localPath, PinState::OnlineOnly);
590+
std::ignore = data.folder->vfs().setPinState(data.folderRelativePath, PinState::OnlineOnly);
591591

592592
// Trigger sync
593593
data.folder->schedulePathForLocalDiscovery(data.folderRelativePath);

src/plugins/vfs/xattr/vfs_xattr.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,18 @@ LocalInfo VfsXAttr::statTypeVirtualFile(const std::filesystem::directory_entry &
355355
return LocalInfo(path, type);
356356
}
357357

358+
// expects a relative path
358359
bool VfsXAttr::setPinState(const QString &folderPath, PinState state)
359360
{
360-
qCDebug(lcVfsXAttr) << folderPath << state;
361+
const auto localPath = QDir::toNativeSeparators(params().filesystemPath + folderPath);
362+
qCDebug(lcVfsXAttr) << localPath << state;
361363

362364
if (state == PinState::AlwaysLocal || state == PinState::OnlineOnly || state == PinState::Excluded) {
363365
auto stateStr = pinStateToString(state);
364-
addPlaceholderAttribute(folderPath, pinstateXAttrName, stateStr);
366+
addPlaceholderAttribute(localPath, pinstateXAttrName, stateStr);
365367
} else {
366368
qCDebug(lcVfsXAttr) << "Do not set Pinstate" << pinStateToString(state) << ", remove pinstate xattr";
367-
FileSystem::Xattr::removexattr(FileSystem::toFilesystemPath(folderPath), pinstateXAttrName);
369+
FileSystem::Xattr::removexattr(FileSystem::toFilesystemPath(localPath), pinstateXAttrName);
368370
}
369371
return true;
370372
}

0 commit comments

Comments
 (0)