Making an istaller with data file in certain position


#1

Hi there!
is there any way to create an installer file (like .pkg on mac or .exe on win) that installs the app in the Application folder (both Mac and Win) and create a Folder with data (that must be downloaded after on the first run) in Document folder (or similar)?!
thank you


#2

I am not sure that I understand your question clearly.
Based on my understanding app have read/write permission only inside
console.log(app.getPath('userData'))

From render process you can do that like this
const {app} = require(‘electron’).remote;
var get_app_path = app.getPath(‘userData’)+’/file’;
var mydata ='test data’
fs.writeFile(path_for_proxy_file, mydata, function(err) {});


#3

The question in about the electron-builder (i found how set the correct path). actually what i’m trying to do is building the file for the autoupdater with asar.


#4

Can you explain how you did it? It would be really interesting to know how to add data known to the main electron process as app.getPath(‘userData’) during installation with electron-builder.