cameron
cameron

Reputation: 29

Copy a folder with all its contents and sub folders

just started using NullSoft and im trying to install a folder with its files and subfolder i cant figure out whats wrong can i have help?

OutFile "Autoclicker.exe"

InstallDir $PROGRAMFILES

Section
SetOutPath $INSTDIR
CopyFiles "C:\Users\cameron\Desktop\NullSoft\PH INSTALLER\Data\Autoclicker\Autoclickr.ink" "$DESKTOP" 
WriteUninstaller $INSTDIR\Uninstaller.exe
File /r "C:\Users\cameron\Desktop\NullSoft\PH INSTALLER\Data\Autoclicker\"

SectionEnd 

Section "Uninstall"
Delete $INSTDIR\Autoclicker
Delete $INSTDIR\Uninstaller.exe
SectionEndenter code here

Upvotes: 0

Views: 114

Answers (2)

KennZAney1
KennZAney1

Reputation: 91

As @Anders, stated, you can use the File /rto recursively install files. The documentation is located at NSIS File Reference

Upvotes: 0

Anders
Anders

Reputation: 101646

InstallDir should contain the name of your application in its path, not just the root directory you want to install to.

CopyFiles copies files from one place on the end-users machine to another, it cannot be used to extract files from your installer! It is usually used to copy files from a CD or make a backup copy of something.

When using the File instruction with /r you should use a wildcard filespec to include all files.

I would suggest that you change your code to something like this:

!define MySource "C:\Users\cameron\Desktop\NullSoft\PH INSTALLER\Data\Autoclicker"

InstallDir $PROGRAMFILES\Autoclicker

Section
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\Uninstaller.exe
File /r "${MySource}\*.*"
SetOutPath $Desktop
File "${MySource}\Autoclickr.ink"
SectionEnd

I don't know what a .INK file is but it does not sound like something that belongs on the users desktop. If you actually mean .LNK (a shortcut/link) then you should use the CreateShortcut instruction to create the .LNK file:

CreateShortcut "$Desktop\Autoclikr.lnk" "$InstDir\MyApp.exe"

Finally, in your uninstaller you must use RMDir /r to delete a directory, not Delete.

Upvotes: 1

Related Questions