Is it possible to find a exe without path in an electron app?


#1

Hello,

I got a small app and it opens games, files or programs on a button click, but i can only open the files when i give a specific path like this example here using steam:

function steam() {
event.preventDefault();
shell.openExternal('C:\\Program Files (x86)\\Steam\\Steam.exe')

};

Is there a way that other user can add their path (just like discord) or that it searches the system for the exe etc. ?


#2

If the executable is in a folder on your system PATH, the only thing you need to send to the shell is steam and it will locate the first file by that name in all the PATH folders. This is true on every operating system I know of.


#3

If i understand this right, it would be

function steam() {
event.preventDefault();
shell.openExternal('Steam.exe')
};

or am i wrong?


#4

Looking at it, I would expect that to work.


#5

It sadly doesn’t


#6

If you share a repo with your code, I could experiment a little when I get time.