Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 22nd April 2020, 03:38   #1
jlh@sfs
Junior Member
 
Join Date: Apr 2020
Posts: 2
Best practices for script design: ProgramFiles and user files

I'm developing my first installation package with NSIS. The application UI is developed in C# in VS2017 on Windows 10 and the install package was originally developed with Windows Installer. Because of limitations with Windows Installer, the user had to perform functions I wanted to handle in installation and I think I can do that with NSIS. I wish to install the application per computer with the program files placed in the current Program Files directory and user specific input/output data in the current user's Documents directory. Uninstall is to be provided for the program files but not for the data files. Once the installation is done for the first user with administrator rights, other users could install their own input/output data files, preferably with standard rights. First of all, I would welcome advice on whether this is a reasonable design plan and, secondly, I'm wondering how the script should be laid out to do this. Can it all be handled in a single script or is it necessary to develop separate scripts for the program files and the data files, which could then be embedded in a separate script for execution. I sincerely appreciate any advice you can give.
jlh@sfs is offline   Reply With Quote
Old 22nd April 2020, 10:43   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,294
Mixing ProgramFiles and user files in the same installer is not recommended.

The Microsoft guidelines say that you should install to ProgramFiles. When a user runs your application for the first time, the application itself should copy your template files from a shared location (%programfiles% or %programdata%) to the users profile.

If you don't want to follow the rules, you can use a hack like GetUserShellFolderFromRegistry

See also:
- NSIS best practices

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd April 2020, 12:48   #3
jlh@sfs
Junior Member
 
Join Date: Apr 2020
Posts: 2
That makes perfect sense and it can be done with the existing installer. Thanks for the lesson.
jlh@sfs is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
script design, windows 10

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