News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Tip: SMF 2.0.17/2.0.18 - Using multiple modification files in package installer

Started by GL700Wing, February 06, 2021, 04:09:32 AM

Previous topic - Next topic

GL700Wing

In the process of updating a few mods to support SMF 2.018 I discovered that some only needed one line of code to be changed from the SMF 2.0.17 modification file.

However, with some modification files having close to 1100 lines of code I decided to find out if the package installer would support multiple <modification> statements/files - if it did I would then be able to have three modification files:
one with the modification code that is common to SMF 2.0.17 and SMF 2.0.18;
one with the modification code for SMF 2.0.17 and earlier; and
one the modification code for SMF 2.0.18.

So I tested this approach with several mods and it worked - the package installer applied the modification changes in both modification files!!

For me this is a major benefit/significant feature as it means that instead of duplicating the common code for SMF 2.0.17 and SMF 2.0.18 (and having to maintain/update this common code in multiple modification files in the future) I only have to maintain/update one set of the common code (which for all of these mods was the bulk of the code and almost 1100 lines in one case).

Just thought I'd share this tip with others who need to update their mods to support SMF 2.0.18 ...

Sample package-info.xml file:
Quote<install for="2.0.10 - 2.0.17">
      <readme type="file" parsebbc="true">readme.txt</readme>
      <modification type="file">install_20x-common.xml</modification>
      <modification type="file">install_20x-pre2018.xml</modification>
   </install>
   <install for="2.0.18 - 2.0.99">
      <readme type="file" parsebbc="true">readme.txt</readme>
      <modification type="file">install_20x-common.xml</modification>
      <modification type="file">install_20x-from2018.xml</modification>
   </install>
   <install for="2.1 RC3">
      <readme type="file" parsebbc="true">readme.txt</readme>
      <modification type="file">install_21RC3.xml</modification>
   </install>

   <uninstall for="2.0.10 - 2.0.17">
      <modification type="file" reverse="true">install_20x-common.xml</modification>
      <modification type="file" reverse="true">install_20x-pre2018.xml</modification>
   </uninstall>
   <uninstall for="2.0.18 - 2.0.99">
      <modification type="file" reverse="true">install_20x-common.xml</modification>
      <modification type="file" reverse="true">install_20x-from2018.xml</modification>
   </uninstall>
   <uninstall for="2.1 RC3">
      <modification type="file" reverse="true">install_21RC3.xml</modification>
   </uninstall>
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: