diff --git a/plugins/builtin/romfs/lang/en_US.json b/plugins/builtin/romfs/lang/en_US.json index c597b0482..316cc93d0 100644 --- a/plugins/builtin/romfs/lang/en_US.json +++ b/plugins/builtin/romfs/lang/en_US.json @@ -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}>", diff --git a/plugins/builtin/source/content/providers/file_provider.cpp b/plugins/builtin/source/content/providers/file_provider.cpp index 7b9820029..58f0cc3b3 100644 --- a/plugins/builtin/source/content/providers/file_provider.cpp +++ b/plugins/builtin/source/content/providers/file_provider.cpp @@ -24,6 +24,8 @@ #if defined(OS_WINDOWS) #include +#elif defined(OS_MACOS) || defined(OS_LINUX) + #include #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; }