About   |   Getting Started   |   Downloads   |   Documentation   |   Forum


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
exiting gracefully
10-26-2017, 11:09 AM
Post: #1
exiting gracefully
If a plugin checks on startup whether it's compatible with the host version of AI, and finds it is not, is there a recommended way to gracefully exit? It's pretty easy for the plugin to skip features that aren't compatible, but if it's unable to be useful, should it just disable itself? Can it completely unload or remove itself (call its own shutdown and destroy methods)?

In the case of AI 22 (CC 2018), can an earlier plugin show an explanatory dialog and then somehow allow AI to continue startup without crashing?

Any guidance would be much appreciated.
Find all posts by this user
Quote this message in a reply
10-30-2017, 02:45 PM
Post: #2
RE: exiting gracefully
Here's what we do in our plugins to handle versions of Illustrator outside the supported range:
  • In our Plugin wrapper class, keep a flag to indicate whether the startup() method successfully finished (default of false, of course).
  • At the beginning of our startup() method, check if the major version of Illustrator is outside the range of versions supported by the plugin.
  • If the above condition is false, continue starting up. If the above condition is true, show an error dialog stating "This version of $pluginName was designed for Illustrator $aiVersionList only. Please visit $productURL for additional information." and exit the startup() method.
  • Additionally check if the major version of Illustrator does not match the version for which the binary was built.
  • If the above condition is false, continue starting up. If the above condition is true, show an error dialog stating "This version of $pluginName was designed for a different version of Illustrator. Please reinstall using the original $pluginName installer." and exit the startup() method.
  • Finally perform any needed startup tasks, because the versions all match up at this point. Set the successful startup flag to true.
  • In the shutdown() method, check the successful startup flag, and if false perform no shutdown tasks.

Find all posts by this user
Quote this message in a reply
05-12-2018, 09:52 AM
Post: #3
RE: exiting gracefully
Thanks, Garrett, this is perfect.

It would be nice to check the bitness but since Illustrator won't load a mismatched version, it's kind of a moot point. Another reason to write a good installer app, huh? Rolleyes
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)