更新 install.mel
This commit is contained in:
45
install.mel
45
install.mel
@@ -87,12 +87,16 @@ global proc installMCPPlugin() {
|
|||||||
|
|
||||||
// Load the plugin
|
// Load the plugin
|
||||||
print("Loading plugin...\n");
|
print("Loading plugin...\n");
|
||||||
if (!`pluginInfo -q -loaded $pluginPath`) {
|
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 + "\"");
|
evalEcho("loadPlugin \"" + $pluginPath + "\"");
|
||||||
print("Plugin loaded successfully\n");
|
print("Plugin loaded successfully\n");
|
||||||
} else {
|
|
||||||
print("Plugin already loaded\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set plugin to auto load
|
// Set plugin to auto load
|
||||||
print("Setting plugin to auto load...\n");
|
print("Setting plugin to auto load...\n");
|
||||||
@@ -122,10 +126,43 @@ global proc uninstallMCPPlugin() {
|
|||||||
// Unload plugin
|
// Unload plugin
|
||||||
print("Unloading plugin...\n");
|
print("Unloading plugin...\n");
|
||||||
if (`pluginInfo -q -loaded $pluginPath`) {
|
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 + "\"");
|
evalEcho("unloadPlugin \"" + $pluginPath + "\"");
|
||||||
print("Plugin unloaded successfully\n");
|
print("Plugin unloaded successfully\n");
|
||||||
} else {
|
} else {
|
||||||
print("Plugin not loaded, no need to unload\n");
|
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
|
// Disable auto load
|
||||||
|
Reference in New Issue
Block a user