cuberite / CuberitePluginChecker

Automated script for CI-checking Cuberite plugins
The Unlicense
3 stars 3 forks source link

Added redirectPluginFiles action #45

Closed NiLSPACE closed 3 months ago

NiLSPACE commented 3 months ago

redirectPluginFiles is an action similar to redirect which allows you to redirect paths to another path. redirectPluginFiles only looks at files inside the plugin's folder.

Also fixed bug where the simulator would check the inheritance of strings and functions.

The following has been added to the ScenarioFiles.md file:

redirectPluginFiles

Adds a redirection for files inside the plugin folder. All Cuberite APIs that take a file or folder path check if the file needs to be redirected. This is useful if you want to use a different configuration file in your scenario. It can also be used to insert mocks in the code. The following table should make it clear how it works.

Key provided in dictionary Value provided in dictionary Path provided by plugin Path actually used
config.cfg config.cfg Plugins/[myplugin]/config.cfg [scenarioPath]/config.cfg
Classes/Storage.lua mocks/Storage.lua Plugins/[myplugin]/Classes/Storage.lua [scenarioPath]/mocks/Storage.lua

Takes a dictionary table which maps the old paths to the new paths.

redirectPluginFiles
{
    -- Redirect the 'config.cfg' file from the plugin folder to the scenario folder
    ["config.cfg"] = "config.cfg"
}
NiLSPACE commented 3 months ago

If there are no objections I'd like to merge this.