@Component
public class DefaultFiles
extends java.lang.Object
LocalizationManager for use of localization, but creates one if injected one is null.
Ensures all files needed by ServerPackCreator are available. If any one is missing, a new one is generated from the template. Among the default files are:
serverpackcreator.conf
server.properties
server-icon.png
start-forge.bar
start-forge.sh
start-fabric.bat
start-fabric.sh
Should an old configuration file, creator.conf, be detected, it is renamed to serverpackcreator.conf to ensure a configuration file is present at all times.
| Constructor and Description |
|---|
DefaultFiles(LocalizationManager injectedLocalizationManager,
ApplicationProperties injectedApplicationProperties)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkDatabase()
Ensures serverpackcreator.db exists.
|
boolean |
checkForFile(java.io.File fileToCheckFor)
Checks for existence of defaults files.
|
void |
filesSetup()
Calls individual methods which check for existence of default files.
|
@Autowired public DefaultFiles(LocalizationManager injectedLocalizationManager, ApplicationProperties injectedApplicationProperties)
Used for Dependency Injection. Receives an instance of LocalizationManager or creates one if the received
one is null. Required for use of localization.
injectedLocalizationManager - Instance of LocalizationManager required for localized log messages.injectedApplicationProperties - Instance of Properties required for various different things.public void filesSetup()
If any file was newly generated from its template, a warning is printed informing the user about said newly generated file. If every file was present and none was generated, "Setup completed." is printed to the console and log.
public boolean checkForFile(java.io.File fileToCheckFor)
fileToCheckFor - The file which is to be checked for whether it exists and if it doesn't, should be created.filesSetup() can inform the user about
said newly generated file.public void checkDatabase()