fix(ios): replace FileManager.default with FileManager() for Swift 6.2 compatibility

This commit is contained in:
Ryan Lisse
2026-01-18 20:46:29 +01:00
committed by Peter Steinberger
parent 87d995bcde
commit e14ff8f407
4 changed files with 9 additions and 9 deletions

View File

@@ -160,14 +160,14 @@ actor CameraController {
defer { session.stopRunning() } defer { session.stopRunning() }
await Self.warmUpCaptureSession() await Self.warmUpCaptureSession()
let movURL = FileManager.default.temporaryDirectory let movURL = FileManager().temporaryDirectory
.appendingPathComponent("clawdbot-camera-\(UUID().uuidString).mov") .appendingPathComponent("clawdbot-camera-\(UUID().uuidString).mov")
let mp4URL = FileManager.default.temporaryDirectory let mp4URL = FileManager().temporaryDirectory
.appendingPathComponent("clawdbot-camera-\(UUID().uuidString).mp4") .appendingPathComponent("clawdbot-camera-\(UUID().uuidString).mp4")
defer { defer {
try? FileManager.default.removeItem(at: movURL) try? FileManager().removeItem(at: movURL)
try? FileManager.default.removeItem(at: mp4URL) try? FileManager().removeItem(at: mp4URL)
} }
var delegate: MovieFileDelegate? var delegate: MovieFileDelegate?

View File

@@ -837,7 +837,7 @@ final class NodeAppModel {
fps: params.fps, fps: params.fps,
includeAudio: params.includeAudio, includeAudio: params.includeAudio,
outPath: nil) outPath: nil)
defer { try? FileManager.default.removeItem(atPath: path) } defer { try? FileManager().removeItem(atPath: path) }
let data = try Data(contentsOf: URL(fileURLWithPath: path)) let data = try Data(contentsOf: URL(fileURLWithPath: path))
struct Payload: Codable { struct Payload: Codable {
var format: String var format: String

View File

@@ -91,7 +91,7 @@ final class ScreenRecordService: @unchecked Sendable {
let includeAudio = includeAudio ?? true let includeAudio = includeAudio ?? true
let outURL = self.makeOutputURL(outPath: outPath) let outURL = self.makeOutputURL(outPath: outPath)
try? FileManager.default.removeItem(at: outURL) try? FileManager().removeItem(at: outURL)
return RecordConfig( return RecordConfig(
durationMs: durationMs, durationMs: durationMs,
@@ -104,7 +104,7 @@ final class ScreenRecordService: @unchecked Sendable {
if let outPath, !outPath.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { if let outPath, !outPath.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
return URL(fileURLWithPath: outPath) return URL(fileURLWithPath: outPath)
} }
return FileManager.default.temporaryDirectory return FileManager().temporaryDirectory
.appendingPathComponent("clawdbot-screen-record-\(UUID().uuidString).mp4") .appendingPathComponent("clawdbot-screen-record-\(UUID().uuidString).mp4")
} }

View File

@@ -2,7 +2,7 @@ import Foundation
public enum ClawdbotNodeStorage { public enum ClawdbotNodeStorage {
public static func appSupportDir() throws -> URL { public static func appSupportDir() throws -> URL {
let base = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first let base = FileManager().urls(for: .applicationSupportDirectory, in: .userDomainMask).first
guard let base else { guard let base else {
throw NSError(domain: "ClawdbotNodeStorage", code: 1, userInfo: [ throw NSError(domain: "ClawdbotNodeStorage", code: 1, userInfo: [
NSLocalizedDescriptionKey: "Application Support directory unavailable", NSLocalizedDescriptionKey: "Application Support directory unavailable",
@@ -19,7 +19,7 @@ public enum ClawdbotNodeStorage {
} }
public static func cachesDir() throws -> URL { public static func cachesDir() throws -> URL {
let base = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first let base = FileManager().urls(for: .cachesDirectory, in: .userDomainMask).first
guard let base else { guard let base else {
throw NSError(domain: "ClawdbotNodeStorage", code: 2, userInfo: [ throw NSError(domain: "ClawdbotNodeStorage", code: 2, userInfo: [
NSLocalizedDescriptionKey: "Caches directory unavailable", NSLocalizedDescriptionKey: "Caches directory unavailable",