| 57 | } |
| 58 | |
| 59 | Result<Void> DiskCacheImpl::store(const Path& path, const BytesView& bytes) { |
| 60 | auto resolvedPath = resolveAbsolutePath(path, false); |
| 61 | if (!resolvedPath) { |
| 62 | return resolvedPath.moveError(); |
| 63 | } |
| 64 | |
| 65 | auto filePath = resolvedPath.moveValue(); |
| 66 | |
| 67 | if (filePath.getComponents().size() > 1) { |
| 68 | auto directoryPath = filePath.removingLastComponent(); |
| 69 | if (!DiskUtils::isDirectory(directoryPath) && !DiskUtils::makeDirectory(directoryPath, true)) { |
| 70 | return Error(STRING_FORMAT("Failed to create directories to store file at {}", filePath.toString())); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | return DiskUtils::store(filePath, bytes); |
| 75 | } |
| 76 | |
| 77 | Ref<IDiskCache> DiskCacheImpl::scopedCache(const Path& subfolder, bool allowsReadOutsideOfScope) const { |
| 78 | auto result = resolveAbsolutePath(subfolder, false); |
nothing calls this directly
no test coverage detected