Skip to content

Commit 5614784

Browse files
committed
fix: add tvOS/watchOS guard for volumeAvailableCapacityForImportantUsageKey
1 parent 078ff89 commit 5614784

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/apple/Sources/Engine/InferenceEngine.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public enum InferenceEngineFactory {
6969
) async throws -> any InferenceEngine {
7070
switch type {
7171
case .llamaCpp:
72-
guard #available(iOS 17.0, macOS 14.0, *) else {
73-
throw LocanaraError.custom(.featureNotAvailable, "LlamaCppEngine requires iOS 17.0+ or macOS 14.0+")
72+
guard #available(iOS 17.0, *) else {
73+
throw LocanaraError.custom(.featureNotAvailable, "LlamaCppEngine requires iOS 17.0+")
7474
}
7575
let llamaConfig = LlamaCppEngine.Configuration(
7676
numThreads: config.numThreads,

packages/apple/Sources/ModelManager/ModelManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ public final class ModelManager: @unchecked Sendable {
366366
}
367367

368368
// Fall through to built-in LlamaCppEngine
369-
guard #available(iOS 17.0, macOS 14.0, *) else {
370-
throw LocanaraError.modelLoadFailed("LlamaCppEngine requires iOS 17.0+ or macOS 14.0+")
369+
guard #available(iOS 17.0, *) else {
370+
throw LocanaraError.modelLoadFailed("LlamaCppEngine requires iOS 17.0+")
371371
}
372372
let engine = try await LlamaCppEngine.create(
373373
modelPath: modelPath,

packages/apple/Sources/ModelManager/ModelStorage.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,17 @@ public final class ModelStorage: @unchecked Sendable {
313313
///
314314
/// - Returns: Available space in bytes
315315
public func getAvailableStorage() -> Int64 {
316+
#if os(tvOS) || os(watchOS)
317+
return 0
318+
#else
316319
do {
317320
let values = try baseDirectory.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey])
318321
return values.volumeAvailableCapacityForImportantUsage ?? 0
319322
} catch {
320323
logger.error("Failed to get available storage: \(error.localizedDescription)")
321324
return 0
322325
}
326+
#endif
323327
}
324328

325329
/// Check if there's enough space for a model

0 commit comments

Comments
 (0)