Add Windows legacy server cleanup for %LOCALAPPDATA%\Programs\UnityMCP\UnityMcpServer (#272)

- Detect and clean up legacy server installations in LocalApplicationData
- Prevents accumulation of old server copies during package updates
- Improves cleanup of Windows-specific legacy installation paths
main
dsarno 2025-09-09 10:18:22 -07:00 committed by GitHub
parent 3e83f993bf
commit 9d17061452
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -314,6 +314,11 @@ namespace MCPForUnity.Editor.Helpers
string roaming = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) ?? string.Empty; string roaming = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) ?? string.Empty;
if (!string.IsNullOrEmpty(roaming)) if (!string.IsNullOrEmpty(roaming))
roots.Add(Path.Combine(roaming, "UnityMCP", "UnityMcpServer")); roots.Add(Path.Combine(roaming, "UnityMCP", "UnityMcpServer"));
// Windows legacy: early installers/dev scripts used %LOCALAPPDATA%\Programs\UnityMCP\UnityMcpServer
// Detect this location so we can clean up older copies during install/update.
string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) ?? string.Empty;
if (!string.IsNullOrEmpty(localAppData))
roots.Add(Path.Combine(localAppData, "Programs", "UnityMCP", "UnityMcpServer"));
} }
catch { } catch { }
return roots; return roots;