local ExtUtils = {} local cjson = require "cjson" function ExtUtils.slurpFile( name ) local f = assert( io.open( name, "rb" ) ) local content = f:read( "*all" ) f:close() return content end function getManifest() local fn = Helix.Core.Server.GetArchDirFileName( "manifest.json" ) return cjson.decode( ExtUtils.slurpFile( fn ) ) end function trim( s ) return ( s:gsub( "^%s*(.-)%s*$", "%1" ) ) end function getICfg() local cfg = {} for k, v in pairs( Helix.Core.Server.GetInstanceConfigData() ) do cfg[ k ] = trim( v ) end return cfg end function ExtUtils.msgHeader() return ExtUtils.manifest[ "name" ] .. "/" .. ExtUtils.manifest[ "key" ] .. "/" .. ExtUtils.manifest[ "version_name" ] .. ": " end ExtUtils.manifest = {} ExtUtils.iCfgData = {} function ExtUtils.init() if ExtUtils.iCfgData[ "path" ] == nil then ExtUtils.iCfgData = getICfg() end if ExtUtils.manifest[ "key" ] == nil then ExtUtils.manifest = getManifest() end end return ExtUtils
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 30809 | C. Thomas Tyler |
Code drop with newer versions of Extensions. Thanks to @jason_gibon. #review-30810 @jabson_gibson |