Adobe-CEP / Getting-Started-guides

Getting Started guides and samples for CEP extensions
Apache License 2.0
548 stars 92 forks source link

File Operation Error when installing .zxp for Illustrator on Mac #44

Closed KristalAlfred closed 1 year ago

KristalAlfred commented 1 year ago

Submit an issue

Topic

This is an issue regarding:

Versions

Description of the issue

Hi! I'm trying to package and install an extension with an accompanying plugin for Illustrator. I can't seem to wrap my head around how to properly package everything as a .zxp file. I'm trying to follow along with the examples but I have run into some questions. I'll walk through the process below.

Right now I'm just trying to get the extension to properly install itself into the CEP/extensions folder on mac. From what I gather in the examples, the complete extension folder (where the CSXS/manifest.xml is located) should be packaged using the ZXPSignCmd tool into a single extension.zxp file. There's a few questions I have here:

After packaging the extension, I want to bundle it together with the plugin.aip file which it depends on. To do this, I understand that you have to bundle everything into a common folder that looks something like this:

Product/
|__Extension/
   |__extension.zxp
|__Plugin/
   |__plugin.aip
|__id.mxi

where the id.mxi specifies where the contents should go. Is this correct?

I tried to keep the contents of the .mxi file similar to the examples. This is the entire file:

<?xml version="1.0" encoding="UTF-8"?>
<macromedia-extension 
    id="example"
    name="example"
    requires-restart="false"
    version="1.0.0">

    <author name="AKE"/>

    <description>
        <![CDATA[<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><p>some text</p>]]>
    </description>

     <ui-access>
        <![CDATA[You can run this extension by choosing<br>
        <p>Run the extension!</p>]]>
    </ui-access>

    <license-agreement>
        <![CDATA[You are about to install an Extension.]]>
    </license-agreement>

    <products>
        <product familyname="Illustrator" version="27"/>
    </products>

    <files>
        <file source="Extension/extension.zxp"
              destination=""
              file-type="CSXS"
              products="Illustrator"
              minVersion="27.0" />

        <file source="Plugin/plugin.aip"
              destination="$installfolder/Plug-ins"
              file-type="plugin"
              products="Illustrator"
              minVersion="27.0" />
    </files>
</macromedia-extension>

I use the ZXPSignCmd to package everything together.

When trying to install this with the ExManCmd CLI I just get the cryptic error Failed to install, status = -164! back. I understand from this resource that there's probably something wrong with the files part, but I need help understanding what. Some additional questions/notes:

I know there's a lot of questions here, I hope that's fine. I greatly appreciate any help, reading recommendations or other helpful resources/advice to help me complete this :)

Thank you! Alfred

ErinFinnegan commented 1 year ago

Hi Alfred!

It's impressive you've made it this far... πŸ˜… I'll do my best to answer some of your questions below:

Right now I'm just trying to get the extension to properly install itself into the CEP/extensions folder on mac. From what I gather in the examples, the complete extension folder (where the CSXS/manifest.xml is located) should be packaged using the ZXPSignCmd tool into a single extension.zxp file. There's a few questions I have here:

Is this correct?

Yes, that's correct.

Is it also correct that the .mxi file is not necessary here?

Yes. It's an optional file.

When I try to install this .zxp file directly after packaging it, I get a success message but the extension is not present in the CEP/extensions folder (checked both the common and user libraries). Is this the expected behaviour? If yes, where is the extension installation location?

So, you can have an unsigned CEP extension that should work provided you've set debug mode. Note that the CSXS version I referred to there is the same as the CEP version, you can check version numbers against product numbers on this chart... you may need to set the debug mode to CSXS.11 for the latest Illustrator version.

Typically this sort of thing happens when:

Product/
|__Extension/
   |__extension.zxp
|__Plugin/
   |__plugin.aip
|__id.mxi

where the id.mxi specifies where the contents should go. Is this correct?

Yes, that looks correct to me...

However, I think you don't have to have a ZXP inside a ZXP, I think you can structure it like this:

myCEPplugin.zxp
β”œ- myCEPdir
β”‚  β”œ- index.js
β”‚  β”œ- index.jsx
β”‚  β”œ- manifest.xml
β”‚  β”œ- index.html
β”‚  β””- CSInterface.js
└─ id.mxi

When trying to install this with the ExManCmd CLI I just get the cryptic error Failed to install, status = -164! back. I understand from this resource that there's probably something wrong with the files part, but I need help understanding what. Some additional questions/notes:

Have you tried UPIA?

Is the destination="$installfolder/Plug-ins" part correct usage of the path tokens? Is this the best way to install an accompanying .aip plugin for the user? I have tried commenting out the entire plugin part of the .mxi and deleting the files prior to signing. When the plugin part is included, the error is Failed to install, status = -160!. When it isn't, the error is the Failed to install, status = -164! reported earlier.

πŸ€” -160, "File not found"... that does imply that the id.mxi file isn't working quite right.

You could do a sanity check, and download the CEP sample extension and see if Illustrator will launch it. (I've been meaning to add a zipped version of the sample to the repo so it's easier to test...)

The signing tool seems to create META-INF folders in the input folders, what are those? Are they just artifacts or are they used for something?

I don't know. πŸ˜… I'll defer to @sujaisivanandan on that...

This one is a little bit off topic: Where do you get the ID for the plugin? On this page the ID is "[...] assigned by Adobe when you submit your extension." But from what I've read you need a valid package to be able to submit the .zxp package, which seems to create a catch-22 situation.

I was just talking to an Engineering Manager about updating the MXI documentation, so this is good to note...

If you're distributing your extension through Adobe's plugin marketplace, you'll get an id number, but this isn't a requirement. You're not obligated to distribute there.

In Steve's examples, he's just thrown in: id="id" or id="EXTENSION-ID"

Someone else ran into a problem recently where the product familyname in the mxi file was creating a problem...

The MXI documentation seems like a relic from the Extension Manager days... Extension Manager was deprecated, but it's still necessary to use MXI files for installing more than just the expected CEP files.

Let us know if you figure out what the issue is!

KristalAlfred commented 1 year ago

Hi!

Thanks for the awesome reply!! I was just able to properly install both the extension into the CEP/extensions-folder and the Plug-in into the Adobe Illustrator/Plug-ins-folder!

I discovered the main issue when doing a sanity check with the test extension as you suggested. While debugging I've just installed the ZXP using the tools, but to remove it I just removed the folder manually. When I tried re-installing the test extension a few times the same issue appeared, which made me look into it. Turns out you have to remove the extension using the tool too, otherwise the installer just returns a success message without (seemingly) actually doing anything since it's already installed. For future versions it would be pretty cool if there was some kind of error or warning when this happens.

I corrected all version numbers as you suggested, but when I backtracked to see if they caused the 160 & 164 error they seemed not to. I also tried to copy earlier versions of my MXI that failed with those error codes too, but I couldn't reproduce it today so I'm guessing it was a human error.

Also a cautionary note about placing the plugin: the installer seems to overwrite anything in the folder specified in the MXI. I accidentally nuked my Illustrator installation a few times to get it right πŸ˜…

Thanks for all the help and information, I'm very happy it's working now! ☺️

ErinFinnegan commented 1 year ago

Wait, OK, above you mention "the installer" and "the tool" - are you talking about UPIA or ExManCmd? (Or something else?) Just checking!

It's also worth noting that you don't have to use either tool for CEP, you can unzip ZXPs and put the folder in one of the valid CEP directories... (this is called "side-loading" internally) I mean provided the extension hasn't touched Adobe's Exchange Marketplace...

KristalAlfred commented 1 year ago

The mistake I made applies to both, so 'the tool/s' in the post above refers to both ExManCmd and UPIA. When I said 'the installer' I also meant those two tools, sorry about the confusion.

I see, interesting! Thanks for the info.