-
Notifications
You must be signed in to change notification settings - Fork 274
Description
Describe the Bug
A further problem with backward compatibility of add on library pathnames, this time in a Javascript instance.
I have Javascript calling a macro in library/mtscript/public/ which then tries to call another macro in library/mtscript
- In MapTool 1.17.1 this works fine.
- In MapTool 1.18.6 this fails (without any error messages to help identify the problem).
To Reproduce
My Javascript file library/public/trackerscript.js in part contains:
async function getLibProperty(propertyName) { const macro = '[r:getLibProperty("' + propertyName + '", "icarean.0001.Time_tracker")]'; let r = await fetch("macro:evaluateMacro@lib:icarean.0001.Time_tracker", { method: "POST", body: macro }); return await r.text(); } currentYear = parseInt(await getLibProperty("currentYear"));
The evaluateMacro.mts script is just one line:
[r:evalMacro(macro.args)]
The evaluateMacro.mts was located in in library/mtscript/ , and this worked fine in MapTool 1.17.1 but does not work in 1.18.6.
If I move evaluateMacro.mts to library/mtscript/public/ , it now works in 1.18.6 as well as still working in 1.17.1.
The Wiki ( https://wiki.rptools.info/index.php/Technical_definition_of_Add-on_Libraries ) says "Since the public/ is not required, if you have two files with the same name when excluding the public/ directory component, then only the one in public/ will be able to be executed. You will not be able to call the other macro." which suggests the functionality of 1.17.1 was correct, and the new functionality of 1.18.6 is unintended.
Note, though, the above problem does not manifest when a macro is called from another macro.
I've created a token with a Settings macro, which contains just one line:
[macro("Settings@lib:icarean.0001.Time_tracker"):""]
Settings.mts contains just these lines:
[frame5("Time_tracker settings", "width=600; height=400; temporary=1; input=0; noframe=0"): { [macro("settingshtml@this"):""] }]
And settingshtml.mts , which is located in library/mtscript , is launched perfectly fine in v1.17.1 and 1.18.6.
Expected Behaviour
One of:
- Running evalMacro() from within an add on library accesses a script in library/mtscript/ , if this was the intended behaviour.
- Running evalMacro() from within an add on library accesses a script in library/mtscript/ , if this was not the intended behaviour but backward compatability is important.
- Clear communication (e.g. in the Wiki) about a change in behaviour in v1.18.x , and some error message output about the script not being located to assist the library coder in identifying the problem.
Screenshots
No response
MapTool Info
1.18.6
Desktop
Ubuntu 25.10
Additional Context
Probably related to these other bugs I've logged about add on library pathname changes:
- [https://github.com/[Bug]: Change to add on library onFirstInit between v1.17.1 and 1.18.6 #5877]
- [https://github.com/[Bug]: Presumably inadvertent change to accepted paths in data.getStaticData() #5883]