Class MMDataLicenseHeader

java.lang.Object
mekhq.utilities.MMDataLicenseHeader

public final class MMDataLicenseHeader extends Object
Produces the MegaMek Data legal notice that leads every saved data file, as a block of # comment lines. This mirrors the mechanism megamek's UnitFileResaver uses for plain-text unit files, so the notice is always present and correct rather than authored by hand.

The copyright year is carried forward: a file whose existing header starts in an earlier year is rewritten as a start-current range, so re-saving a shipped file preserves its original year. Files with no readable header fall back to the current year.

  • Method Details

    • licenseHeader

      public static String licenseHeader(@Nullable File targetFile)
      Builds the license header block for a data file.
      Parameters:
      targetFile - the file the header will be written to, read for its existing copyright year (may be null or not yet exist)
      Returns:
      the license notice, each line prefixed with # and the whole block ending in a newline