Code-Ersetzung mit Teams (TXT-Import, nur neue Spieler nachladen, Auto-Reload), Codes ohne Trennzeichen, Cursor bleibt stehen; Auswerfen per diskutil mit Wiederholung direkt nach dem Kopieren
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
1 parent
d39db536a0
commit
25729ebfe3
10 files changed
+615
-134
No files matched your search
@@ -254,6 +254,22 @@ public enum IngestService {
|
||||
lockedCopies: lockedCopies, nextSequence: seq, skipped: skipped)
|
||||
}
|
||||
|
||||
/// Ejects a memory card via `diskutil eject` (more reliable than NSWorkspace, reports who blocks it).
|
||||
/// Retries a few times – right after an ingest Spotlight (mds) or QuickLook often still hold the card.
|
||||
/// Returns nil on success, otherwise the error text.
|
||||
public static func eject(volume: URL, attempts: Int = 4) async -> String? {
|
||||
var last = ""
|
||||
for attempt in 0..<attempts {
|
||||
if attempt > 0 { try? await Task.sleep(nanoseconds: 2_000_000_000) }
|
||||
if let r = try? await FTPUploader.run("/usr/sbin/diskutil", ["eject", volume.path], stdin: nil) {
|
||||
if r.status == 0 { return nil }
|
||||
last = (r.stderr + r.stdout).trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
}
|
||||
if !FileManager.default.fileExists(atPath: volume.path) { return nil } // already gone
|
||||
}
|
||||
return last.isEmpty ? "diskutil eject fehlgeschlagen" : last
|
||||
}
|
||||
|
||||
static func sameSize(_ a: URL, _ b: URL) -> Bool {
|
||||
func size(_ u: URL) -> Int64? {
|
||||
guard let attrs = try? FileManager.default.attributesOfItem(atPath: u.path) else { return nil }
|
||||
|
||||
Reference in new issue
Block a user