mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
* fix(xml): resolve <Script file> subdirectory paths relative to the XML file The XML file processor joins <Include file> onto the including file's directory, but <Script file> only when the value has no backslash (strchr at 0x006EE06E); a value with one is loaded from the game root. So <Script file="widgets\AceGUIWidget-Button.lua"/> inside Libs\AceGUI-3.0\AceGUI-3.0.xml fails with "Error loading widgets\AceGUIWidget-Button.lua" - all 23 AceGUI-3.0 widget files in Zygor Guides Viewer 2.0, and every other addon that embeds AceGUI-3.0. Later clients resolve it relative to the XML file. Co-hook the XML file processor (FUN_XML_LOAD_FILE) to track the file being processed, and at the <Script> call into FUN_LUA_LOAD_FILE (return address RET_XML_SCRIPT_FILE_LOAD) retry a backslash path that does not exist as given against that file's directory, only when the joined file exists. Root-relative paths that load on vanilla are unchanged. FUN_LUA_LOAD_FILE is already co-hooked by AddOns::SavedVarsFirst, which now calls Xml::ScriptPath::Resolve first. Verified in-game (1.12.1 client via VanillaFixes, Zygor Guides Viewer 2.0): a probe addon's <Script file="sub\File.lua"/> loads from its XML file's folder, and Zygor's AceGUI-3.0 option pages, built from those widget files, work. * refactor(xml): share the Lua file-loader hook; collapse .. in Script paths FUN_LUA_LOAD_FILE now has one owner, Script::LoadFile, which runs path rewriters and then suppressors. Xml::ScriptPath is a rewriter and AddOns::SavedVarsFirst a suppressor, so neither module reaches into the other's hook. Xml::ScriptPath joins onto the XML file's folder with each \..\ collapsed first, as FUN_XML_LOAD_FILE does before its own joins; the tracked pointer is the caller's uncollapsed path, so an XML file reached through <Include file="..\x.xml"/> joined onto a path with .. in it. The user docs no longer name later clients or what 1.12 does. --------- Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>