0

I am trying to get the path for my app inside one of the HTML windows. I have the following code:

<script>
const { remote } = require('electron');
        var path = require('path');
        var appPath = path.dirname(remote.app.getPath('exe'));
        console.log(appPath)

I don't understand how to define app inside the html views? This outputs the error of

Cannot read property of 'app' of undefined
RavenMan
  • 73
  • 1
  • 8
  • is it really nodejs? it seems you have a script tag at the beggining of your code, I would assume it's in browser and if that's the case this is not how you access external libraries – Krzysztof Krzeszewski Jun 28 '21 at 14:57
  • 1
    Does this answer your question? [Electron.remote is undefined](https://stackoverflow.com/questions/37884130/electron-remote-is-undefined) – pushkin Jun 28 '21 at 16:07

1 Answers1

0

https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions Your description is too simplistic

const win = new BrowserWindow({
    webPreferences: {
        enableRemoteModule: true
    }
}); 

This may help you!

ajie
  • 11
  • 5