bennymeg / nx-electron

Electron schematics for nrwl nx platform
Apache License 2.0
328 stars 85 forks source link

How to get the executable's execution path #298

Closed KaraboMolemane closed 2 months ago

KaraboMolemane commented 3 months ago

Describe the bug This feels like an easy question but I am not able to find an answer anywhere. When the user launches the executable, say from their Downloads folder, the app does a quick installation into their AppData and executes from there. Is there a way to get the directory which they initially launched the executable from? In this case the Downloads folder. All the methods I have tried so far return the AppData directory.

To Reproduce Steps to reproduce the behavior: N/A

Expected behavior There should be a method that returns the path that the user first launched the executable from, be it the Downloads folder., Desktop folder, or any directory on their OS.

Screenshots N/A.

Desktop (please complete the following information):

Additional context Currently I am using a workaround where I have a C++ app that launches the electron app and passes in the path. This does not work properly as electron does not always read the args properly, so we write the path to a text file, and the electron executable reads the text file.

Thanks in advance :D

bennymeg commented 2 months ago

I do not think it is possible to do it directly. In the future, please use discussion for questions