Opening JSON file 'EPERM: operation not permitted' when installed for all users


#1

I’m a linux user, so it could be im just asking a very stupid question…:sunglasses:

But, on windows, when I do a production build with electron-builder, install the created build and select to install for ‘all users’, the server gets a permission error when trying to open json files.

EPERM: operation not permitted, open 'C:\Program Files\TradeJS\resources\app\server\config\tradejs.config.json.

Pretty simple permission problem I would say, but the only thing google learns me is that its a bad practise to install the app in the program files folder?? The recommendation is to install it in c:\LoremIpsum\etc,

But I cannot agree with that, cause all programs are installed in program files is it not??

Also when I install as ‘current user only’, the problem does not exist…

Any thoughts??

Thanks guys!


Window.open does not work when main process has forked children
#2

Writing in program files require admin right. That is probably what is missing. (Looks like reading too)

If you want to deploy without right, I think Atom itself follow the best practice, thru squirrel installer.
User data in: %UserProfile%\AppData\Roaming
Binary in : %UserProfile%\AppData\Local

%UserProfile% default to something like: C:\Users\UserName


#3

Thanks @jeancroy for the quick response! Will try that.

Is there a way to do it with the NSIS installer also? Or do you not recommend using that installer?


#4

I never tried but

$PROFILE might be equivalent to %UserProfile%
http://nsis.sourceforge.net/Docs/Chapter4.html#variables


#5

Not all. The Program Files folders are protected so that you know that anything in them was given explicit administrator permission to be there. This is a measure to protect novice users and causes trouble for valid use cases where the user knows what they’re doing. I have a lot of programs outside of those two folders.