Copy link to clipboard
Copied
Hi All,
I want to read "Version" attribute of an extension from manifest.xml file in my panel. Refer below xml snippet:
<ExtensionList>
<Extension Id="com.test.myExt" Version="1.0.1" />
</ExtensionList>
I have referred Extension object from CSInterface but I couldn't find any property or method which provides Version value. Can anybody help me to get this?
Premiere Pro version: 11.0.1
Extension Type: Panel
Thanks & Regards,
Meet Tank
1 Correct answer
Hi Meet,
you would have to read the contents of the manifest.xml file and parse it like a regular XML. Here is how it works:
getInstalledPanelVersion = function() {
var fs = require('fs');
var extension_dir = decodeURI(window.__adobe_cep__.getSystemPath(SystemPath.EXTENSION));
if (navigator.platform.toLowerCase().indexOf("win") >= 0) {
extension_dir = extension_dir.replace("file:///", "");
} else {
extension_dir = extension_dir.replace("file://", "");
}
var manifest_path = require('path').
Copy link to clipboard
Copied
Why would you ask a host application what version your own panel is? Don't you know that?
Copy link to clipboard
Copied
Hello Bruce,
Different users might have installed a different version of zxp. So to know which version is currently being used we need to maintain zxp version somewhere in manifest file.
Bruce Bullis My suggestion is that we should add version property under Extension object in csInterface.
Thanks,
Meet
Copy link to clipboard
Copied
Hi Meet,
you would have to read the contents of the manifest.xml file and parse it like a regular XML. Here is how it works:
getInstalledPanelVersion = function() {
var fs = require('fs');
var extension_dir = decodeURI(window.__adobe_cep__.getSystemPath(SystemPath.EXTENSION));
if (navigator.platform.toLowerCase().indexOf("win") >= 0) {
extension_dir = extension_dir.replace("file:///", "");
} else {
extension_dir = extension_dir.replace("file://", "");
}
var manifest_path = require('path').join(extension_dir, "CSXS", "manifest.xml");
var manifest_str = fs.readFileSync(manifest_path, "utf8");
var parser = new DOMParser();
var manifest = parser.parseFromString(manifest_str, "text/xml");
return manifest.getElementsByTagName("ExtensionManifest")[0].getAttribute("ExtensionBundleVersion");
};
Should work, if not, it will give you some inspiration.
I hope this helps.
Thomas
Copy link to clipboard
Copied
Thanks Thomas_Szabo. I found a different way to achieve this. I have added "ExtensionData" under "DispatchInfo" as below:
<ExtensionData>
<Version>1.0.1</Version>
</ExtensionData>
This will be available in "defaultExtensionDataXML" property of Extension object under csInterface.
Thanks,
Meet
Copy link to clipboard
Copied
meett9325076​ Hi, I know this is an old post, but I'm trying your solution to the issue and having some difficulties. I've added "ExtensionData" under "DispatchInfo" as you mentioned, but the extension object I'm accessing does not even have a "defaultExtensionDataXML" property.
I've been looking for documentation on this and haven't been able to find any example uses. Do you mind sharing where you found the info on <ExtensionData>, if you can remember/find it?
Thanks so much!
Copy link to clipboard
Copied
Hi mg73365387
Can you please confirm that <ExtensionData> is set as per below hierarchy?
ExtensionManifest -> DispatchInfoList -> Extension -> DispatchInfo -> ExtensionData
Thanks,
Meet
Copy link to clipboard
Copied
Hi meett9325076​
Yes, that is the hierarchy I'm using. (The <ExtensionData> is at the same level as <Resources>, <Lifecycle>, <UI>, etc.)
Any ideas what might be happening?
Thanks for replying!
Copy link to clipboard
Copied
To clarify, I've added the following:
- <ExtensionData>
- <Version>1.0.0</Version>
- </ExtensionData>
to the hierarchy at the same level as <Resources>, <Lifecycle>, <UI>, etc.
I'm then trying to access the extension object using the CEP interface as follows:
const myExtension = getExtensions([getExtensionID()]);
When I use the JavaScript debugger to examine myExtension, it doesn't have a field for version (from <Version> in <ExtensionData>), but it does have a field for name (from <Menu> in <UI>), mainPath (from <MainPath> in <Resources>), etc.
Copy link to clipboard
Copied
Hi mg73365387
Please refer below code snippet:
const myExtension = getExtensions([getExtensionID()]);
const version = GetValueByKey(myExtension[0].defaultExtensionDataXML, "Version");
Where GetValueByKey is part of Vulcan.js (Samples/Vulcan.js at master · Adobe-CEP/Samples · GitHub )
I hope it helps.
Thanks,
Meet

