2

I am looking to access the focused (frontmost finder app's) opened directory. I have been searching around and I have managed to get the frontmost app and to check if it is Finder, but I have not been able to find anything on actually accessing that window to extract the opened directory. If anyone has any idea how to do this I would really appreciate some guidance. Basically, I am looking to get something like "~/Documents/SuperSecretFolder/" or something along those lines.

The code I have so far to identify if the finder window is the frontmost app

let frontApp = NSWorkspace.shared().frontmostApplication
if (frontApp?.localizedName == "Finder"){
    print("Finder is the main window")
}

Thanks for any help!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.