Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let package = Package(
platforms: [
.macOS(.v13),
.iOS(.v16),
.tvOS(.v14),
.tvOS(.v16),
.watchOS(.v6),
.visionOS(.v1)],
products: [
Expand Down
11 changes: 11 additions & 0 deletions Sources/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ enum Device {
return Int64(space)
}

#if os(tvOS)
static var freeDiskSpaceInBytes: ByteCountFormatter.Units.Bytes {
guard let space = try? URL(fileURLWithPath: NSHomeDirectory() as String)
.resourceValues(forKeys: [URLResourceKey.volumeAvailableCapacityKey])
.volumeAvailableCapacity else {
return 0
}
return ByteCountFormatter.Units.Bytes(space)
}
#else
static var freeDiskSpaceInBytes: ByteCountFormatter.Units.Bytes {
guard let space = try? URL(fileURLWithPath: NSHomeDirectory() as String)
.resourceValues(forKeys: [URLResourceKey.volumeAvailableCapacityForOpportunisticUsageKey])
Expand All @@ -58,4 +68,5 @@ enum Device {
}
return space
}
#endif
}
Loading