So I'm aware without react on the render thread I can do this to open a file dialog.
const {dialog} = require('electron').remote
dialog.showOpenDialog({properties: ['openFile']}))
I'm trying to use react and learn the workflows of React & Electron though. Doing the require gives me the following error.
TypeError: fs.existsSync is not a function
getElectronPath
5 | var pathFile = path.join(__dirname, 'path.txt');
6 |
7 | function getElectronPath() {
> 8 | if (fs.existsSync(pathFile)) {
9 | var executablePath = fs.readFileSync(pathFile, 'utf-8');
10 |
11 | if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {
View compiled
(anonymous function)
18 | }
19 | }
20 |
> 21 | module.exports = getElectronPath();
View compiled
Unsure what I can do to make this work. Should be a pretty simple canvas drawing app, but i do need to enumerate images in folders & give file dialog capabilities to the app. Any ideas how to remedy this issue?