Electron.NET icon indicating copy to clipboard operation
Electron.NET copied to clipboard

Get path to the file that launched the application

Open MSiffert opened this issue 4 years ago • 0 comments

Considering we have one for more file associations inside our electron.manifest.json

"fileAssociations": [
  {
    "ext": "sdg",
    "name": "SDG",
    "role": "Editor"
  }
]

There should be an API inside the Electron API to see how the App was launched. Environment.GetCommandLineArgs() does not contain any information about the file that launched the application because these parameters are not passed to the dotnet process by the Electron host. Environment.GetCommandLineArgs() will always only include the following parameters:

  • environment
  • electronPort
  • electronWebPort

This is extremely common for desktop applications and should, at least in my opinion, be an essential feature. Note: I am using .NET 5 and Blazor Server

MSiffert avatar Sep 08 '21 11:09 MSiffert