Skip to content

Commit

Permalink
mac/app: add some verbose logging for app startup and file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Akemi committed Apr 1, 2024
1 parent 9c0fc83 commit fe1de11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions osdep/mac/app_hub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class AppHub: NSObject {
#if HAVE_MACOS_MEDIA_PLAYER
remote = RemoteCommandCenter(self)
#endif
log.verbose("AppHub initialised")
}

@objc func initMpv(_ mpv: OpaquePointer) {
Expand All @@ -64,15 +65,18 @@ class AppHub: NSObject {
#if HAVE_MACOS_TOUCHBAR
touchBar = TouchBar(self)
#endif
log.verbose("AppHub functionality initialised")
}

@objc func initInput(_ input: OpaquePointer?) {
log.verbose("Initialising Input")
self.input.signal(input: input)
}

@objc func initCocoaCb() {
#if HAVE_MACOS_COCOA_CB
if !isApplication { return }
log.verbose("Initialising CocoaCB")
DispatchQueue.main.sync {
self.cocoaCb = self.cocoaCb ?? CocoaCB(mpv_create_client(mpv, "cocoacb"))
}
Expand All @@ -81,12 +85,14 @@ class AppHub: NSObject {

@objc func startRemote() {
#if HAVE_MACOS_MEDIA_PLAYER
log.verbose("Starting RemoteCommandCenter")
remote?.start()
#endif
}

@objc func stopRemote() {
#if HAVE_MACOS_MEDIA_PLAYER
log.verbose("Stoping RemoteCommandCenter")
remote?.stop()
#endif
}
Expand All @@ -100,6 +106,7 @@ class AppHub: NSObject {
}.sorted { (strL: String, strR: String) -> Bool in
return strL.localizedStandardCompare(strR) == .orderedAscending
}
log.verbose("Opening dropped files: \(files)")
input.open(files: files)
}

Expand Down
1 change: 1 addition & 0 deletions osdep/mac/application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class Application: NSApplication, NSApplicationDelegate {

let path = (ProcessInfo.processInfo.environment["PATH"] ?? "") +
":/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin"
appHub.log.verbose("Setting Bundle $PATH to: \(path)")
_ = path.withCString { setenv("PATH", $0, 1) }
}

Expand Down

0 comments on commit fe1de11

Please sign in to comment.