mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-12 13:59:46 -04:00
fix: macOS 13 clang cannot hash std::filesystem::path
Work around another issue on macOS 13 where trying to build an `std::unordered_set<std::filesystem::path>` results in an error because `std::hash<std::filesystem::path>` is not provided. Simply use the unix path instead, this should make no difference and might even be slightly faster.
This commit is contained in:
parent
9a9d5365b6
commit
f7969109d5
@ -359,14 +359,18 @@ bool filesystem_extractor_<LoggerPolicy>::extract(
|
||||
}
|
||||
};
|
||||
|
||||
std::unordered_set<std::filesystem::path> matched_dirs;
|
||||
// Don't use an unordered_set<std::filesystem::path> here, this will break
|
||||
// on macOS 13 due to clang not knowing how to hash std::filesystem::path.
|
||||
std::unordered_set<std::string> 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_<LoggerPolicy>::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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user