Skip to content

Commit 7907812

Browse files
committed
fix: added hash function for std::filesystem::path when on macOS
1 parent 63f9a96 commit 7907812

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Core/VFS.hh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
#include <filesystem>
55
#include <unordered_map>
66

7+
#if defined(__APPLE__) && defined(__MACH__)
8+
// NOTE: only tested on `macOS 10.15.7 (Catalina) 19H15 x86_64` + `AppleClang 12.0.0`
9+
template <>
10+
struct std::hash<std::filesystem::path> {
11+
std::size_t operator()(const std::filesystem::path &p) const {
12+
return std::hash<std::string>()(p.string());
13+
}
14+
};
15+
#endif
16+
717
namespace volt::core {
818
class VFS {
919
std::unordered_map<std::filesystem::path, std::filesystem::path> m_mountPoints;

0 commit comments

Comments
 (0)