Hot Door CORE Forum

Full Version: exiting gracefully
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
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