Old 30th January 2021, 01:49   #1
wrybread
Junior Member
 
Join Date: Oct 2007
Posts: 22
Possible to make a config file writable?

I'm using NSIS to install a program under Windows 10, and it installs to C:\Program Files (x86)\MyProgram

It creates a config file in that folder:

C:\Program Files (x86)\MyProgram\configs.txt

But I need to be admin to modify that file. Is there some way for NSIS to create that file with user control permissions?

If not, is there some other directory I should be creating that file in?

Thanks for any help.
wrybread is offline   Reply With Quote
Old 30th January 2021, 05:42   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,542
The AccessControl plug-in can change the security but application configuration files that users modify should be stored in %AppData% ($AppData).

Your program should create this file, not the installer.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 30th January 2021, 05:50   #3
wrybread
Junior Member
 
Join Date: Oct 2007
Posts: 22
Quote:
The AccessControl plug-in can change the security but application configuration files that users modify should be stored in %AppData% ($AppData).
Thanks for that. I'd much prefer the program is "portable", with all the files in one location, so hoping to avoid that. But I guess that's a good fallback.

Quote:
Your program should create this file, not the installer.
If my program creates the config file in it's program directory, would that file then be writable?
wrybread is offline   Reply With Quote
Old 30th January 2021, 12:43   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,542
$ProgramFiles is not writable for normal users. If multiple users run your program at the same time from program files you will get issues. Portable programs should not be installed in Program Files for this reason.

Some programs support normal and portable mode by looking in a config file in the same folder as the .exe.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump