Safari Web Extension to open the remote server file in native application

I have created a sample safari extension where I need to open the remote file in native application. But when iam trying to access the file only the folder directory is opened. But my requirement is to open the file in native application. As the file is in remote server so, i use smb:// protocol to have a connection.

if let url = URL(string: path) {
    if NSWorkspace.shared.open(url) {
       print("Url is opened")
    }
}

url: smb://192.168.150.46/cifsshare/AM_SM0656.tif 

Do I need to update any permission or keys in the info.plist which will enable the file opening in default application (ex. Preview).

Replies

I have also tried with the process but the result is same. Below is the code that i have tried.

//1
    let toolPath = "/usr/bin/open"
    let arguments = [pathUrl.absoluteString]
     
    //2
    let task = Process()
    task.launchPath = toolPath
    task.arguments = arguments
     
    task.launch()
    task.waitUntilExit()

pathUrl : The path to the location of the file at remote location ( smb://192.168.150.46/cifsshare/AM_SM0656.tif)

Result: Iam able to access the enclosing directory, but file is not open in native application. (viz. preview)

Expected: File at pathURL should be opened in preview.