local ExtUtils = {} local cjson = require "cjson" function getManifest() local fn = Helix.Core.Server.GetArchDirFileName( "manifest.json" ) local fh = assert( io.open( fn, "r" ) ) local m = cjson.decode( fh:read( "*all" ) ) fh:close() return m end function trim( s ) return ( s:gsub( "^%s*(.-)%s*$", "%1" ) ) end function getGCfg() local cfg = {} -- There's also GetInstanceConfigData() for k, v in pairs( Helix.Core.Server.GetGlobalConfigData() ) do cfg[ k ] = trim( v ) end return cfg end function ExtUtils.getID() return ExtUtils.manifest[ "name" ] .. "/" .. ExtUtils.manifest[ "key" ] .. "/" .. ExtUtils.manifest[ "version_name" ] end function ExtUtils.msgHeader() return ExtUtils.getID() .. ": " end ExtUtils.manifest = {} ExtUtils.gCfgData = {} function ExtUtils.init() if ExtUtils.gCfgData[ "Swarm-URL" ] == nil then ExtUtils.gCfgData = getGCfg() end if ExtUtils.manifest[ "key" ] == nil then ExtUtils.manifest = getManifest() end end return ExtUtils
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 30808 | C. Thomas Tyler |
Promoted from 2019.1/... to main/... |
||
//guest/perforce_software/extensions/2019.1/swarm/ExtUtils.lua | |||||
#1 | 25601 | Jason Gibson |
Import example Extensions. p19.1@1797741 |