feat(plugin): uninstall + clean upgrade/reinstall of external plugins

Add an Uninstall button on installed external plugin cards that deletes
the package folder (effective next restart — the library stays resident
for the session). Reinstalling or upgrading via the marketplace now
clears any stale native library with a different name before writing the
new one, so the loader always picks the freshly installed binary.

Part of the #100 extensibility epic (phase 2).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-17 15:57:44 +03:00
1 parent eb53e445ab
commit 157412419e
5 files changed
+49

No files matched your search

+2
View File
@@ -1073,6 +1073,8 @@ pub enum Message {
PluginInstall(String),
/// Result of an install: the plugin id, or an error message.
PluginInstalled(Result<String, String>),
/// Delete an installed plugin's folder (effective next restart).
PluginUninstall(String),
// ── Point Style (DDPTYPE) dialog ──────────────────────────────────────
/// Set the full PDMODE value from a glyph-grid cell.
PointStyleSetMode(i16),
+18
View File
@@ -5699,6 +5699,24 @@ impl OpenCADStudio {
self.marketplace_status = format!("Install failed: {e}");
Task::none()
}
Message::PluginUninstall(id) => {
#[cfg(not(target_arch = "wasm32"))]
{
match crate::plugin::external::uninstall(&id) {
Ok(()) => {
self.marketplace_status =
format!("Uninstalled '{id}'. Restart to unload it.");
self.external_plugins = crate::plugin::external::discover();
}
Err(e) => {
self.marketplace_status = format!("Uninstall failed: {e}");
}
}
}
#[cfg(target_arch = "wasm32")]
let _ = id;
Task::none()
}
Message::PointStyleSetMode(mode) => {
self.set_point_mode_bits(!0, mode);
Task::none()