Resolve a hash to its cache file path, creating the cache root if needed. Returns `None` if the cache dir can't be created.
(hash: MeshHash)
| 132 | /// Resolve a hash to its cache file path, creating the cache root if |
| 133 | /// needed. Returns `None` if the cache dir can't be created. |
| 134 | fn cache_path(hash: MeshHash) -> Option<PathBuf> { |
| 135 | let dir = cache_dir()?; |
| 136 | if !dir.exists() { |
| 137 | fs::create_dir_all(&dir).ok()?; |
| 138 | } |
| 139 | Some(dir.join(hash.to_filename())) |
| 140 | } |
| 141 | |
| 142 | /// Look up cached voxel bytes. Returns `Some(bytes)` only when the |
| 143 | /// file exists, parses, and matches the expected magic + version + |