Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Sources/ContainerizationOCI/Content/LocalContentStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,21 @@ public actor LocalContentStore: ContentStore {
guard
let enumerator = fileManager.enumerator(
at: self._basePath,
includingPropertiesForKeys: [.totalFileAllocatedSizeKey],
includingPropertiesForKeys: [.totalFileAllocatedSizeKey, .isRegularFileKey],
options: [.skipsHiddenFiles]
)
else {
throw ContainerizationError(.internalError, message: "failed to enumerate content store at \(self._basePath.path)")
}
var size: UInt64 = 0
for case let fileURL as URL in enumerator {
guard let values = try? fileURL.resourceValues(forKeys: [.totalFileAllocatedSizeKey]),
guard let values = try? fileURL.resourceValues(forKeys: [.totalFileAllocatedSizeKey, .isRegularFileKey]), values.isRegularFile == true,
let fileSize = values.totalFileAllocatedSize
else {
// Skip directories and other non-regular entries. On Linux,
// `.totalFileAllocatedSizeKey` reports block allocation for
// directories, which would otherwise count empty-store
// inode overhead as content.
continue
}
size += UInt64(fileSize)
Expand Down
Loading