Auto-detect whisper-cli path for Intel and ARM Macs
- Check multiple paths: /opt/homebrew/bin (ARM), /usr/local/bin (Intel), /opt/local/bin (MacPorts), ~/bin (user local) - Show error status if whisper-cli not found - Use isExecutableFile to verify binary exists and is executable Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -442,6 +442,24 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Whisper CLI Detection
|
||||||
|
func findWhisperCLI() -> String? {
|
||||||
|
// Check common paths for whisper-cli
|
||||||
|
let paths = [
|
||||||
|
"/opt/homebrew/bin/whisper-cli", // ARM Mac (M1/M2/M3)
|
||||||
|
"/usr/local/bin/whisper-cli", // Intel Mac
|
||||||
|
"/opt/local/bin/whisper-cli", // MacPorts
|
||||||
|
NSHomeDirectory() + "/bin/whisper-cli" // User local
|
||||||
|
]
|
||||||
|
|
||||||
|
for path in paths {
|
||||||
|
if FileManager.default.isExecutableFile(atPath: path) {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Transcription
|
// MARK: - Transcription
|
||||||
func transcribe() {
|
func transcribe() {
|
||||||
// Validate inputs before execution
|
// Validate inputs before execution
|
||||||
@@ -464,8 +482,18 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard let whisperPath = findWhisperCLI() else {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.statusItem.button?.title = "🎤"
|
||||||
|
self.updateStatus("⚠️ whisper-cli not found")
|
||||||
|
if self.playSounds { NSSound(named: "Basso")?.play() }
|
||||||
|
NSLog("whisper-cli not found in PATH")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let task = Process()
|
let task = Process()
|
||||||
task.executableURL = URL(fileURLWithPath: "/opt/homebrew/bin/whisper-cli")
|
task.executableURL = URL(fileURLWithPath: whisperPath)
|
||||||
task.arguments = ["-m", modelPath, "-l", language.lowercased(), "-f", audioFilePath]
|
task.arguments = ["-m", modelPath, "-l", language.lowercased(), "-f", audioFilePath]
|
||||||
|
|
||||||
let pipe = Pipe()
|
let pipe = Pipe()
|
||||||
|
|||||||
Reference in New Issue
Block a user