samcrow / rust-xplm

Rust interfaces to the X-Plane plugin SDK
Apache License 2.0
39 stars 15 forks source link

Deprecate CommandCreateError::Exists #16

Closed JDeeth closed 8 months ago

JDeeth commented 8 months ago

Commands persist between reloads of the plugin. If the (aircraft) plugin creates a command, it will work on the first run. Reload the aircraft and it will give a false positive error by finding the command created on the previous run.

XPLMCreateCommand returns the existing command ref if there is one.

Fixes #15

samcrow commented 8 months ago

Thanks for contributing. There's apparently no way to destroy a command after creating it, so the new behavior is the only reasonable way to support plugins that get reloaded while X-Plane is running.