I’m having an issue while specifying the preload script path (within my webPreferences) while opening the BrowserWindow from the renderer process.
- My __dirname from the main process points to the root directory of where my app lives (i.e. where i run npm from).
- Somehow, __dirname from a renderer process points to “/” (i.e. root of my machine!!) This is a problem because while specifying the preload script path i end up having to give the full absolute path!
- I tried using remote.app.getAppPath() but end up getting a path that looks like this
Few questions around this:-
- Firstly how do i get my app root directory from within the renderer process?
- Whats the best practice around this?