View Single Post
04-25-18, 09:11 PM   #1
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 45
Library version checking

I was reviewing the LibUIDropDown codes and then realized I made a mistake by putting version revision in the MAJOR_VERSION, which will result in multiple version of libs get loaded and some functions could be conflicted.
Before:
Lua Code:
  1. local MAJOR_VERSION = "LibUIDropDownMenu-1.07.7030024931"
  2. local MINOR_VERSION = 90000 + tonumber(("$Rev: 25 $"):match("%d+"))
  3.  
  4. local LibStub = _G.LibStub
  5. if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
  6. local lib = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
  7. if not lib then return end

Now I have fixed it to below:
Lua Code:
  1. local MAJOR_VERSION = "LibUIDropDownMenu"
  2. local MINOR_VERSION = 90000 + tonumber(("$Rev: 30 $"):match("%d+"))
  3.  
  4. local LibStub = _G.LibStub
  5. if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
  6. local lib = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
  7. if not lib then return end

But I am wondering how to do similar version checking in XML files?
The LibUIDropDownMenu has two XML files, and while synchronizing the changes in WoW 8.0.1, there are several changes need to be implemented in those XML files. So question pops up.

Instead of moving all those XML UI to be handled in Lua, I wonder if there is some easy way to do it within XML file.
  Reply With Quote