Greetings All:
I seem to be having an issue on macOS with my desktop app. I have it coded such that when the user right-clicks a file, and selects open with myapp, then my desktop app will launch and open that file.
On Mac, Windows, and Linux this works fine, with a notable exception:
On Windows and Linux, while my app is still running, I can go to the file explorer, right click on a different file and open it in a “new” instance of my application. On the Mac, however, as long as I have an instance of my app already running, nothing happens. It simply won’t launch a new instance.
Here’s the code I use to open a new instance.
// Launching another instance of the current running app
#If TargetMacOS Then
var exe As FolderItem = App.ExecutableFile
var appBundle As FolderItem = exe.Parent.Parent.Parent
var s As New Shell
s.Execute("open -n " + appBundle.NativePath)
#ElseIf TargetWindows Or TargetLinux Then
App.ExecutableFile.Open
#EndIf
I am using the DocumentOpened Event within the App Object as well, which populates this folderitem: f = New FolderItem(App.LoadFileReferenced, FolderItem.PathModes.Native)
App.LoadFileReferenced is a public property that holds the Folderitem passed in via the DocumentOpened event. Then in the open event of my Window, is where I have code that loads the file into memory.
Like I said earlier, it only works on the Mac as long as no instance of my app is already open. Am I missing some setting for the Mac that will allow multiple instances of a desktop app to open?
I know that it’s going to be a ‘duh’ moment.