From f7969109d5506ce1ae759373046bf412b4bf351c Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Wed, 19 Mar 2025 22:29:44 +0100 Subject: [PATCH] fix: macOS 13 clang cannot hash `std::filesystem::path` Work around another issue on macOS 13 where trying to build an `std::unordered_set` results in an error because `std::hash` is not provided. Simply use the unix path instead, this should make no difference and might even be slightly faster. --- src/utility/filesystem_extractor.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/utility/filesystem_extractor.cpp b/src/utility/filesystem_extractor.cpp index ec1bda7a..114b93d4 100644 --- a/src/utility/filesystem_extractor.cpp +++ b/src/utility/filesystem_extractor.cpp @@ -359,14 +359,18 @@ bool filesystem_extractor_::extract( } }; - std::unordered_set matched_dirs; + // Don't use an unordered_set here, this will break + // on macOS 13 due to clang not knowing how to hash std::filesystem::path. + std::unordered_set matched_dirs; if (matcher) { + // Collect all directories that contain matching files to make sure + // we descend into them during the extraction walk below. fs.walk([&](auto entry) { if (!entry.inode().is_directory()) { if (matcher->match(entry.unix_path())) { while (auto parent = entry.parent()) { - if (!matched_dirs.insert(parent->fs_path()).second) { + if (!matched_dirs.insert(parent->unix_path()).second) { break; } entry = *parent; @@ -385,16 +389,17 @@ bool filesystem_extractor_::extract( auto inode = entry.inode(); if (matcher) { - LOG_TRACE << "checking " << entry.unix_path(); + auto const unix_path = entry.unix_path(); + LOG_TRACE << "checking " << unix_path; if (inode.is_directory()) { - if (!matched_dirs.contains(entry.fs_path())) { - LOG_TRACE << "skipping directory " << entry.fs_path(); + if (!matched_dirs.contains(unix_path)) { + LOG_TRACE << "skipping directory " << unix_path; // no need to extract this directory return; } } else { - if (!matcher->match(entry.unix_path())) { - LOG_TRACE << "skipping " << entry.fs_path(); + if (!matcher->match(unix_path)) { + LOG_TRACE << "skipping " << unix_path; // no match, skip this entry return; }