xanderfrangos / electron-game-launcher

An Electron-based game launcher for PC. Demo available (use a controller or keyboard):
http://xanderfrangos.com/electron-game-launcher/
49 stars 16 forks source link

Game launcher #6

Open jinzagon opened 3 years ago

jinzagon commented 3 years ago

Hello. Not an issue really I just wanted to ask you as you vae some experience in electronJS. I'm creating my own gaming launcher using electron JS, everything working smoothly. But I don't know how to open executable from "a href" tag. I mean I have a list of games, and each game has it own "a href" for a local executable. I can launch them in firefox using a plugin that allow it, but how can I do it in electron ?

What I tried so far is disabling the websecurity as mentionned somewhere but didn't work. Any ideas ?

bluethefoxofficial commented 3 years ago

you can use the shell function is electron by using it on the renderer under the onclick or href

function open(){

shell.openItem('path to executable');

}

<a href="javascript:shell.openItem('path to executable');">

jinzagon commented 3 years ago

Thank you ! But with this method, wouldn't closing the electron application result in killing the child process ?

RichardKanshen commented 4 months ago

Thank you ! But with this method, wouldn't closing the electron application result in killing the child process ?

Heya, not sure you are still looking for an answer, but a modified version (newer versions have shell.openExternal()) will not close the launched program. I assume the opened program is not actually a child process, so it is not dependant or anything.

https://github.com/xanderfrangos/electron-game-launcher/assets/73738591/71d24e27-795c-425e-b2d7-43a0ef722e11