Archive: Documents and settings folder


Documents and settings folder
Hi, I would like to create an installer for a really simple course, it's only necesary to copy all the files to a certain directory, because then I must add this directory to flash security settings.
The problems are: how can I copy the .cfg file to user directory?

Contents are:

file1.jpg
file2.html
/folder/file3.swf

(of course there are more folders and files, but I'll keep it simple for the example)


Installer should:

a) copy file1.jpg file2.html to 'c:\MyDir\'
b) copy file3.swf to 'c:\MyDir\swf\

and then copy a config.cfg to the user settings folder. Vista, Windows XP, etc are different, so how should I do it?

c-in VISTA) copy file.cfg to 'c:\Users\_USERNAME_\AppData\Roaming\Macromedia\Flash Player\#Security\FlashPlayerTrust\'
c-in XP) copy file.cfg to 'c:\Users\_USERNAME_\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust\'

and maybe sometimes this folder does not exist so I think I should create it first

If anyone can help I would really apreciate it!







; myproject.nsi
;
; This script is perhaps one of the simplest NSIs you can make. All of the
; optional settings are left to their default settings. The installer simply
; prompts the user asking them where to install, and drops a copy of example1.nsi
; there.

;--------------------------------

; The name of the installer
Name "MyProject"

; The file to write
OutFile "myproject.exe"

; The default installation directory
InstallDir $DESKTOP\MyProject

; Request application privileges for Windows Vista
RequestExecutionLevel user

;--------------------------------

; Pages

Page directory
Page instfiles

;--------------------------------

; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File file1.jpg
File file2.html

SectionEnd ; end the section


use

'$APPDATA\Macromedia\Flash Player\#Security\FlashPlayerTrust\'

It's OS independant, so it will work on both XP and Vista.


Thank you jpderuiter for the fast answer :)

I see, and how should I write it in the script? Like this?



Section ""

SetOutPath $INSTDIR

File file1.jpg
File file2.html

SetOutPath $APPDATA\Macromedia\Flash Player\#Security\FlashPlayerTrust\

File file.cfg

SectionEnd ; end the section



Thanks in advance :)






EDIT:

Ok, it works now, that's what I do, I think its correct, isn't it?


Section ""

SetOutPath $INSTDIR

File index.html
File styles.css
File images/boli.jpg

SectionEnd

;--------------------------------

Section "Start Security Settings"

strcpy $INSTDIR "$APPDATA\Macromedia\Flash Player\#Security\FlashPlayerTrust\"

CreateDirectory "$APPDATA\Macromedia\Flash Player\#Security\FlashPlayerTrust\"

SetOutPath $INSTDIR

File file.cfg

SectionEnd


Can be simplified to:
SetOutPath "$APPDATA\Macromedia\Flash Player\#Security\FlashPlayerTrust"
File file.cfg

SetOutPath creates directories recursively so you don't need a CreateDirectory.

Stu


Thank you! It works like a charm now :)