Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/craft_override.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ Packager/CreateCache = False
Paths/CCACHE_DIR = ${Env:HOME}/ccache
Compile/UseCCache = True

[BlueprintSettings]
# ignore for now
opencloud/openvfs.ignored=1

[linux-gcc-x86_64]
Environment/SourceCommand = export PKG_CONFIG_PATH=(/usr/bin/pkg-config --variable pc_path pkg-config) && source /opt/rh/gcc-toolset-14/enable

Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/OCAddVfsPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function(add_vfs_plugin)

set_target_properties(vfs_${__PLUGIN_NAME} PROPERTIES OUTPUT_NAME "OpenCloud_vfs_${__PLUGIN_NAME}")

target_link_libraries(vfs_${__PLUGIN_NAME}
target_link_libraries(vfs_${__PLUGIN_NAME} PRIVATE
libsync
${__PLUGIN_LIBS}
)
Expand Down
6 changes: 4 additions & 2 deletions src/libsync/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ std::optional<QString> FileSystem::Tags::get(const QString &path, const QString
if (Utility::isLinux()) {
platformKey = QStringLiteral("user.") + platformKey;
}
return Xattr::getxattr(toFilesystemPath(path), platformKey);
if (const auto d = Xattr::getxattr(toFilesystemPath(path), platformKey)) {
return QString::fromUtf8(*d);
}
#elif defined(Q_OS_WIN)
QFile file(QStringLiteral("%1:%2").arg(path, key));
if (file.open(QIODevice::ReadOnly)) {
Expand All @@ -314,7 +316,7 @@ OCC::Result<void, QString> FileSystem::Tags::set(const QString &path, const QStr
if (Utility::isLinux()) {
platformKey = QStringLiteral("user.") + platformKey;
}
return Xattr::setxattr(toFilesystemPath(path), platformKey, value);
return Xattr::setxattr(toFilesystemPath(path), platformKey, value.toUtf8());
#elif defined(Q_OS_WIN)
QFile file(QStringLiteral("%1:%2").arg(path, key));
if (!file.open(QIODevice::WriteOnly)) {
Expand Down
7 changes: 3 additions & 4 deletions src/libsync/xattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace FileSystem {
#endif
}

std::optional<QString> Xattr::getxattr(const std::filesystem::path &path, const QString &name)
std::optional<QByteArray> Xattr::getxattr(const std::filesystem::path &path, const QString &name)
{
QByteArray value;
ssize_t res = 0;
Expand All @@ -32,15 +32,14 @@ namespace FileSystem {
} while (res == -1 && errno == ERANGE);
if (res > 0) {
value.resize(res);
return QString::fromUtf8(value);
return value;
} else {
return {};
}
}

Result<void, QString> Xattr::setxattr(const std::filesystem::path &path, const QString &name, const QString &value)
Result<void, QString> Xattr::setxattr(const std::filesystem::path &path, const QString &name, const QByteArray &data)
{
const auto data = value.toUtf8();
#ifdef Q_OS_MAC
const auto result = ::setxattr(path.c_str(), name.toUtf8().constData(), data.constData(), data.size(), 0, XATTR_NOFOLLOW);
#else
Expand Down
5 changes: 2 additions & 3 deletions src/libsync/xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ namespace OCC {
namespace FileSystem {
namespace Xattr {
OPENCLOUD_SYNC_EXPORT bool supportsxattr(const std::filesystem::path &path);
OPENCLOUD_SYNC_EXPORT std::optional<QString> getxattr(const std::filesystem::path &path, const QString &name);
OPENCLOUD_SYNC_EXPORT Result<void, QString> setxattr(const std::filesystem::path &path, const QString &name, const QString &value);

OPENCLOUD_SYNC_EXPORT std::optional<QByteArray> getxattr(const std::filesystem::path &path, const QString &name);
OPENCLOUD_SYNC_EXPORT Result<void, QString> setxattr(const std::filesystem::path &path, const QString &name, const QByteArray &value);
OPENCLOUD_SYNC_EXPORT Result<void, QString> removexattr(const std::filesystem::path &path, const QString &name);
}
}
Expand Down
Loading