Archive: Create a File


Create a File
Is it possible to create a file during installation?

For example:

Create in the $INSTDIR the dummy file "dummy.txt"
With the text "Hi, I'm a dummy" :D

Thanks :p


Use FileOpen, FileWrite and FileClose to do this. Just open a file using FileOpen, write your string into it using FileWrite and close it using FileClose.


OK.
But the files isn't in the compiled source files.
I'm going to create a new one.
Does FileOpen creates new ones?


Yes, FileOpen creates the file if it isn't there already.


thanks dude ;)


Just saw the page you've created on the archive using this code. There is an easier way as can be seen in makensis.nsi:

WriteINIStr "$SMPROGRAMS\NSIS\NSIS Development Site.url" "InternetShortcut" "URL" "http://nsis.sourceforge.net/"


I have a create batch function in my app.
It extracts the base file (compile.bat) which I have already crated here on my pc. That batch has keys in it like so:

<bsp_area>
<bsp_compile_area>
<vis_compile_area>
<rad_compile_area>
<copy_files_area>

I use a modified version of the replacetext function to replace these keys with the right executables (e.g. I replace <bsp_compile_area> with "$INSTDIR\quake2\compilers\qbsp3.exe $8.map" which is all set ready for an ms-dos environment.

I also use a slightly modified replacetext function which allows me to use it like so:

Push "[Text to replace]"
Push "[Replace text with this]"
Call replacetext

-Stu


Will do, KichiK ;) :up: