• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to read extension version from manifest.xml file

Participant ,
May 02, 2017 May 02, 2017

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

TOPICS
SDK

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , May 02, 2017 May 02, 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').

...

Votes

Translate

Translate
Adobe Employee ,
May 02, 2017 May 02, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 03, 2017 May 03, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 02, 2017 May 02, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 03, 2017 May 03, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 11, 2019 Aug 11, 2019

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 12, 2019 Aug 12, 2019

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 13, 2019 Aug 13, 2019

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 13, 2019 Aug 13, 2019

Copy link to clipboard

Copied

To clarify, I've added the following:

  1. <ExtensionData> 
  2.     <Version>1.0.0</Version> 
  3. </ExtensionData>
  4.  

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 13, 2019 Aug 13, 2019

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines