FleetingPlugins
Two things happen to a fleeting plugin. It is loaded like any other plugin, because a document cannot be read without it, but its objects are kept out of the icon panels and out of search — the user asked for a file, not for a new set of components. And the package behind it is deleted from disk again.
The deletion cannot happen while Grasshopper runs. .NET offers no way to unload an assembly from the process, so the earliest a package can go is at shutdown, and on Windows not even then, since the file is still mapped. So the packages to delete are written to a ledger in the settings folder, that ledger is worked through at every startup before any plugin is scoped, and entries survive there until the deletion actually succeeds. A session which crashes therefore still cleans up after itself on the next launch.
Properties
Methods
FlushOnShutdown
#IsFleeting
#| pluginId (Guid) | Id of the plugin to test. |
IsFleetingLocation
#This exists for the moments before a plugin is loaded, when there is no Plugin to read an id from and a file path is all there is — scoping, most notably, which happens first and would otherwise leave the plugin listed as pending in the plugin viewer.
| location (string) | File to test. |
Promote
#A package can hold several plugins, and keeping it keeps all of them. Promoting one therefore promotes every plugin which came out of the same folder — the alternative would leave a sibling marked fleeting while the folder it lives in is never scheduled for deletion again, so its objects would stay hidden for the rest of the session for no reason.
| pluginId (Guid) | Id of a plugin in the package to keep. |
ReconcileLedger
#Register
#The ledger entry is written before the plugin is ever used, not when the session ends, so that a crash cannot leave the package installed forever.
| pluginId (Guid) | Id of the plugin which was loaded. |
| packageName (string) | Name of the Yak package it came from. |
| versionFolder (string) | The package version folder which was created by the installation, and which is the only thing that may be deleted. |
ScheduleRemoval
#Fleeting installations are not the only reason a package needs deleting — a user uninstalling a Yak plugin from the plugin viewer runs into exactly the same wall, that a loaded assembly cannot be deleted on Windows. The ledger is the answer in both cases, so it is offered here rather than duplicated.
| versionFolder (string) | Package version folder to be rid of. |