Zachary C.
Zachary C.

Reputation: 27

How to store extra text file in installer

I am trying to create a electron-builder NSIS script with an extra page that contains a RichEdit with text loaded from a text file. However, the text file doesn't compile into the installer, so if you open the installer on another machine the RichEdit is empty. Is there a way to tell the script to include this text file?

How I am currently adding the RichEdit:

nsDialogs::CreateControl "RichEdit20A" ${__NSD_Text_STYLE}|${ES_MULTILINE}|${WS_VSCROLL}|${WS_HSCROLL}|${ES_READONLY} ${__NSD_Text_EXSTYLE} 0 0 100% 112u ""
Pop $0

FileOpen $4 "${PROJECT_DIR}\textFile.txt" r
loop:
    FileRead $4 $1
    SendMessage $0 ${EM_REPLACESEL} 0 "STR:$1"
    IfErrors +1 loop
FileClose $4

Upvotes: 0

Views: 254

Answers (1)

Anders
Anders

Reputation: 101756

Use File to include the file in the installer:

...
File "/oname=$pluginsdir\textFile.txt" "${PROJECT_DIR}\textFile.txt"
FileOpen $4 "$pluginsdir\textFile.txt" r
...

Upvotes: 2

Related Questions