Old 13th November 2011, 17:46   #1
devguy
Junior Member
 
Join Date: Nov 2011
Posts: 2
install each folder in different locations

Hello I've been given the task of editing an existing nsis script and I am totaly new to all this and under a tight timeline constraint.

I have a layout where I have two folders: 'Data' and 'Executable'

Right now everything is getting copied to 'program files/MyCoolApp'
My section code looks something like this:

Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer

File /r /x "*.nsi" ""

CreateDirectory "$SMPROGRAMS\MyCoolApp"
SectionEnd

The change I have to make is:

1) install everything in the current folder and under "Executable" folder to 'program files/MyCoolApp'

2) nstall the Data folder and all it's contents to the application data location on windows under a sub-folder 'MyCoolApp'

Can someone please help me with what needs to be changed. I would like to do both operations from inside the same section.

Thanks!

Last edited by devguy; 13th November 2011 at 18:51.
devguy is offline   Reply With Quote
Old 13th November 2011, 22:19   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
Installing to $programfiles AND appdata is problematic because of UAC, you should install the default data in $programfiles\yourapp\data or the all users profile and then your application should copy that data to the users appdata folder on first run...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 14th November 2011, 01:55   #3
devguy
Junior Member
 
Join Date: Nov 2011
Posts: 2
OK I figured out that I can use a hidden section to perform the copy of the Data folder, something like this will work

Section -AddData
SetOutPath "c:\MyCoolApp"
SetOverwrite ifnewer
File /r Data
SectionEnd

Also with section MainSection, I just had to add a exclude rule to the File op, like so:
File /r /x Data /x "*.nsi" ""
devguy 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