Skip to main content
Inspiring
May 2, 2017
Answered

How to read extension version from manifest.xml file

  • May 2, 2017
  • 3 replies
  • 3714 views

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

This topic has been closed for replies.
Correct answer Thomas_Szabo

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

3 replies

Inspiring
May 3, 2017

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

mg73365387
Participant
August 11, 2019

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!

Inspiring
August 12, 2019

Hi mg73365387

Can you please confirm that <ExtensionData> is set as per below hierarchy?

ExtensionManifest -> DispatchInfoList -> Extension -> DispatchInfo -> ExtensionData

Thanks,
Meet

Thomas_Szabo
Thomas_SzaboCorrect answer
Inspiring
May 2, 2017

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

Bruce Bullis
Community Manager
Community Manager
May 2, 2017

Why would you ask a host application what version your own panel is? Don't you know that?

Inspiring
May 3, 2017

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