I'm trying to call R from JS in an electron app, which console logs the R version and pwd. It works perfectly when packaged without the asar flag using both electron-builder and electron-packager (see the following screenshot)
However, when I build using asar yarn run build --asar
, I do not get the expected output (See the following screenshot)
The main problem is that the app is not getting correct path to the R file (see the following screenshot).
Although, I have constructed the file path dynamically using path
.
To reproduce the bug
- in windows 10, download the source code from this ftp link
- assuming you have vscode, node.js installed already, in vscode terminal from the ImShot_App_minimal folder run
yarn install
- then run
yarn run build --asar
- run the
imshot-minimal-win32-x64\imshot-minimal.exe
and in the console log check the path to the R file - to get the expected result run step 4 but without --asar flag
What is the reason for getting wrong path? and how to fix this?
thanks