更新 install.mel
This commit is contained in:
47
install.mel
47
install.mel
@@ -87,13 +87,17 @@ global proc installMCPPlugin() {
|
||||
|
||||
// Load the plugin
|
||||
print("Loading plugin...\n");
|
||||
if (!`pluginInfo -q -loaded $pluginPath`) {
|
||||
evalEcho("loadPlugin \"" + $pluginPath + "\"");
|
||||
print("Plugin loaded successfully\n");
|
||||
} else {
|
||||
print("Plugin already loaded\n");
|
||||
if (`pluginInfo -q -loaded $pluginPath`) {
|
||||
// If plugin is already loaded, unload it first
|
||||
print("Plugin already loaded, unloading first...\n");
|
||||
evalEcho("unloadPlugin \"" + $pluginPath + "\"");
|
||||
print("Plugin unloaded\n");
|
||||
}
|
||||
|
||||
// Load the plugin
|
||||
evalEcho("loadPlugin \"" + $pluginPath + "\"");
|
||||
print("Plugin loaded successfully\n");
|
||||
|
||||
// Set plugin to auto load
|
||||
print("Setting plugin to auto load...\n");
|
||||
evalEcho("pluginInfo -edit -autoload true \"" + $pluginPath + "\"");
|
||||
@@ -122,10 +126,43 @@ global proc uninstallMCPPlugin() {
|
||||
// Unload plugin
|
||||
print("Unloading plugin...\n");
|
||||
if (`pluginInfo -q -loaded $pluginPath`) {
|
||||
// Try to remove MCP menu before unloading plugin
|
||||
print("Removing MCP menu...\n");
|
||||
if (`menu -exists "MCPMenu"`) {
|
||||
deleteUI -menu "MCPMenu";
|
||||
print("MCPMenu removed successfully\n");
|
||||
} else {
|
||||
// Try to find any menu containing MCP in its label
|
||||
string $allMenus[] = `lsUI -menus`;
|
||||
int $menuFound = 0;
|
||||
for ($menu in $allMenus) {
|
||||
if (`menu -q -exists $menu`) {
|
||||
string $label = `menu -q -label $menu`;
|
||||
if ($label == "MCP") {
|
||||
deleteUI -menu $menu;
|
||||
print("MCP menu found and removed: " + $menu + "\n");
|
||||
$menuFound = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$menuFound) {
|
||||
print("No MCP menu found to remove\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Now unload the plugin
|
||||
evalEcho("unloadPlugin \"" + $pluginPath + "\"");
|
||||
print("Plugin unloaded successfully\n");
|
||||
} else {
|
||||
print("Plugin not loaded, no need to unload\n");
|
||||
|
||||
// Still try to remove any MCP menu that might exist
|
||||
if (`menu -exists "MCPMenu"`) {
|
||||
deleteUI -menu "MCPMenu";
|
||||
print("MCPMenu removed successfully\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Disable auto load
|
||||
|
Reference in New Issue
Block a user