Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ essential = true

[script]
dependencies = [ "Controls" ]
exports = [ "src/Export.as" ]
timeout = 0
8 changes: 8 additions & 0 deletions src/Export.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace PluginManager
{
/*
Queues a plugin for deletion. Note that this will invalidate the plugin object
passed in on the next frame! Do not use the Plugin handle after calling this!
*/
import void PluginUninstall(Meta::Plugin@ plugin) from "PluginManager";
}
32 changes: 32 additions & 0 deletions src/ExportImpl.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace PluginManager
{
void PluginUninstall(Meta::Plugin@ plugin)
{
startnew(PluginUninstallAsync, plugin);
}

void PluginUninstallAsync(ref@ metaPlugin)
{
auto plugin = cast<Meta::Plugin>(metaPlugin);
if (plugin is null) {
error("tried to uninstall a plugin but it was null!");
return;
}

// Grab ID now since handle will be invalid after uninstalling
const string id = plugin.ID;

::PluginUninstallAsync(metaPlugin);
@metaPlugin = null;
@plugin = null;

// Make sure plugin tab (if open) updates correctly
for (int i = g_window.m_tabs.Length - 1; i >= 0; i--) {
auto tab = cast<PluginTab>(g_window.m_tabs[i]);
if (tab !is null && tab.m_plugin !is null && tab.m_plugin.m_id == id) {
tab.m_plugin.CheckIfInstalled();
break;
}
}
}
}