What is the appropriate way to get notified on DFS junction mount in smb server on Mac OS?

69 Views Asked by At

When smb volume is mounted, we are getting notification in didMount event callback of NSWorkspace. Same is not consistent for DFS volume mount on browse. Is there a way to detect DFS junction mount on browse of smb shares?

We are watching for DFS target mounted on smb volume using NSWorkSpace’s NSWorkspaceDidMountNotification notification in our code. But didMount notification is inconsistent and not reliable. Only for the first time, didMount notification is notified. Later on we are not getting notified with didMount notification, though notification is successful.

Is there any other better approach to be notified on DFS junction mount?

Code snippet:

let workspace = NSWorkspace.shared
        workspace.notificationCenter.addObserver(self, selector: #selector(didMount(_:)) , name: NSWorkspace.didMountNotification, object: nil)

@objc func didMount(_ notification: NSNotification)  {
        NSLog("didMount, mounted userinfo - '%@'.", notification.userInfo!)
}

Expecting some way to get notified on DFS junction mount

0

There are 0 best solutions below