diff --git a/Source/Utility/include/Utility/Tags.h b/Source/Utility/include/Utility/Tags.h index cf0cfb786..474df3957 100644 --- a/Source/Utility/include/Utility/Tags.h +++ b/Source/Utility/include/Utility/Tags.h @@ -7,6 +7,7 @@ #include #include #include +#include namespace nc::utility { @@ -106,6 +107,17 @@ class Tags::Tag } // namespace nc::utility +template <> +struct fmt::formatter : fmt::formatter { + constexpr auto parse(fmt::format_parse_context &ctx) const { return ctx.begin(); } + + template + auto format(const nc::utility::Tags::Tag &_tag, FormatContext &_ctx) const + { + return fmt::format_to(_ctx.out(), "{} ({})", _tag.Label(), std::to_underlying(_tag.Color())); + } +}; + namespace std { template <> diff --git a/Source/VFS/source/Native/Host.mm b/Source/VFS/source/Native/Host.mm index 4eba60985..45b823b84 100644 --- a/Source/VFS/source/Native/Host.mm +++ b/Source/VFS/source/Native/Host.mm @@ -14,6 +14,7 @@ #include "DisplayNamesCache.h" #include "File.h" #include +#include #include "../ListingInput.h" #include "Fetching.h" #include @@ -225,13 +226,16 @@ // there's no point trying // TODO: is it worth routing the I/O here? guess not atm - const int entry_fd = openat(fd, listing_source.filenames[n].c_str(), O_RDONLY | O_NONBLOCK); + const std::string &filename = listing_source.filenames[n]; + const int entry_fd = openat(fd, filename.c_str(), O_RDONLY | O_NONBLOCK); if( entry_fd < 0 ) continue; // guess silenty skipping the errors is ok here... auto close_entry_fd = at_scope_end([entry_fd] { close(entry_fd); }); - if( auto tags = utility::Tags::ReadTags(entry_fd); !tags.empty() ) + if( auto tags = utility::Tags::ReadTags(entry_fd); !tags.empty() ) { + Log::Debug("Extracted the tags of the file '{}': {}", filename, fmt::join(tags, ", ")); listing_source.tags.emplace(n, std::move(tags)); + } } }