feat: Add xatts to file info display

This commit is contained in:
WerWolv
2026-01-02 19:34:19 +01:00
parent b2cc09852d
commit e8a6e102c3
2 changed files with 23 additions and 0 deletions

View File

@@ -460,6 +460,7 @@
"hex.builtin.provider.file.too_large.allow_write": "Allow write access",
"hex.builtin.provider.file.reload_changes": "File has been modified by an external source. Do you want to reload it?",
"hex.builtin.provider.file.reload_changes.reload": "Reload",
"hex.builtin.provider.file.xatts": "Attributes (xatts)",
"hex.builtin.provider.gdb": "GDB Server Data",
"hex.builtin.provider.gdb.ip": "IP Address",
"hex.builtin.provider.gdb.name": "GDB Server <{0}:{1}>",

View File

@@ -24,6 +24,8 @@
#if defined(OS_WINDOWS)
#include <windows.h>
#elif defined(OS_MACOS) || defined(OS_LINUX)
#include <sys/xattr.h>
#endif
namespace hex::plugin::builtin {
@@ -155,6 +157,26 @@ namespace hex::plugin::builtin {
result.emplace_back("hex.builtin.provider.file.modification"_lang, modificationTime);
}
#if defined(OS_MACOS) || defined(OS_LINUX)
{
auto xattrSize = listxattr(m_path.c_str(), nullptr, 0, 0);
if (xattrSize > 0) {
std::string xattrList(xattrSize, 0x00);
listxattr(m_path.c_str(), xattrList.data(), xattrSize, 0);
std::string formattedXattrs;
for (const auto &xattr : wolv::util::splitString(xattrList, std::string(1, 0x00))) {
if (!xattr.empty())
formattedXattrs += fmt::format("- {}\n", xattr);
}
result.emplace_back("hex.builtin.provider.file.xatts"_lang, formattedXattrs);
}
}
#endif
return result;
}