mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
feat: Add xatts to file info display
This commit is contained in:
@@ -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}>",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user