Archive: adding to existing files and not replacing


adding to existing files and not replacing
ok i got an interesting problem, i have a game that is customizable so that people can put in their own charecters.

The file listing the directory of each charecter is pretty straight forward

<Name>x2</name>

<
Name>x3</name>
<
Name>x4</name>
<
Name>x5</name>
<
Name>x6</name>
now people can add any charecter they want so the file can easily change and look like

<Name>x2</name>

<
name>Custom</name>
<
Name>x3</name>
<
Name>x4</name>
<
Name>x5</name>
<
Name>x6</name>
in updates i want to be able to simply add the new lines of code to the file instead of just replacing it, that way my users wont have to re-edit the file after every update. any suggestions?

Try this function:
http://nsis.sourceforge.net/Write_to...le_line_number

If you don't know what line to write to, you can use:
http://nsis.sourceforge.net/ReplaceB...kers_in_a_file
And replace between </name> and <Name>.

These functions are old, so I also recommend using the TextReplace plugin.

-Stu


Originally posted by Afrow UK
Try this function:
http://nsis.sourceforge.net/Write_to...le_line_number

If you don't know what line to write to, you can use:
http://nsis.sourceforge.net/ReplaceB...kers_in_a_file
And replace between </name> and <Name>.

These functions are old, so I also recommend using the TextReplace plugin.

-Stu
hmm thanks, might have to change a few things (add a line at the bottom of the code to spcify what can be replaced) but it should do the trick. Thanks