Page 1 of 1

Testing if a LCB Library or Widget is installed from LCS

Posted: Wed May 09, 2018 6:11 pm
by PaulDaMacMan
I know I saw the answer to this somewhere before, but I can't seem to find it now. How do you test if a certain Widget or LCB Library is installed from LiveCode script? And also how to check if it's a certain version of the target extension?

Thanks in Advance.

Re: Testing if a LCB Library or Widget is installed from LCS

Posted: Thu May 10, 2018 4:20 pm
by PaulDaMacMan
I found it, you check the contents of the loadedExtensions.

Still not sure about how to check meta info, like the version number, of a loaded extensions. It seems like libs that come with LC have a functions that returns it's version.

Re: Testing if a LCB Library or Widget is installed from LCS

Posted: Fri May 11, 2018 3:12 pm
by livecodeali
In the IDE you can do

revIDEExtensions() to get an array with all the metdata. You can cut that down with parameters, eg revIDEExtensions("library") or revIDEExtensions("widget", "installed").

For individual extension properties, use
revIDEExtensionProperty(<kind>, <propName>)

where propName is various things, including:

"status", "name", "type_id", "author", "title", "svgicon", "version", "source_file", "source_type", "type", "uservisible", "support_files", "svgicon", ...

Re: Testing if a LCB Library or Widget is installed from LCS

Posted: Sat May 12, 2018 1:40 am
by PaulDaMacMan
livecodeali wrote:
Fri May 11, 2018 3:12 pm
In the IDE you can do

revIDEExtensions() to get an array with all the metdata. You can cut that down with parameters, eg revIDEExtensions("library") or revIDEExtensions("widget", "installed").

For individual extension properties, use
revIDEExtensionProperty(<kind>, <propName>)

where propName is various things, including:

"status", "name", "type_id", "author", "title", "svgicon", "version", "source_file", "source_type", "type", "uservisible", "support_files", "svgicon", ...
Thanks Ali! I should be able to get that to work for stacks that rely on a certain version of an extension being installed. I found I can include an extension module in the script of a stack by binary64 encoding, decode the binary into a variable and then load a module from that, so I was trying to be proactive, looking ahead to try to avoid possible conflicts with the same module or older version of it that could already be loaded in the IDE. I guess if I want to check the version in a standalone I'd have to sift through the handlers in revideextensionlibrary.livecodescript, where those handlers live (then again there probably wouldn't be much point to doing that in a standalone since the proper version of a module would be included at build time.)