From 96326ee6a104bde549da8aa37b292a9b97d8bf23 Mon Sep 17 00:00:00 2001 From: dsarno Date: Tue, 2 Sep 2025 14:41:29 -0700 Subject: [PATCH] Editor: Detect Windows Store Python (PythonSoftwareFoundation) uv.exe in FindUvPath --- .../Editor/Helpers/ServerInstaller.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/UnityMcpBridge/Editor/Helpers/ServerInstaller.cs b/UnityMcpBridge/Editor/Helpers/ServerInstaller.cs index f6ddeaf..235cf43 100644 --- a/UnityMcpBridge/Editor/Helpers/ServerInstaller.cs +++ b/UnityMcpBridge/Editor/Helpers/ServerInstaller.cs @@ -3,6 +3,7 @@ using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Collections.Generic; +using System.Linq; using UnityEditor; using UnityEngine; @@ -569,6 +570,31 @@ namespace MCPForUnity.Editor.Helpers } catch { } + // Windows Store (PythonSoftwareFoundation) install location probe + // Example: %LOCALAPPDATA%\Packages\PythonSoftwareFoundation.Python.3.13_*\LocalCache\local-packages\Python313\Scripts\uv.exe + try + { + string pkgsRoot = Path.Combine(localAppData, "Packages"); + if (Directory.Exists(pkgsRoot)) + { + var pythonPkgs = Directory.GetDirectories(pkgsRoot, "PythonSoftwareFoundation.Python.*", SearchOption.TopDirectoryOnly) + .OrderByDescending(p => p, StringComparer.OrdinalIgnoreCase); + foreach (var pkg in pythonPkgs) + { + string localCache = Path.Combine(pkg, "LocalCache", "local-packages"); + if (!Directory.Exists(localCache)) continue; + var pyRoots = Directory.GetDirectories(localCache, "Python*", SearchOption.TopDirectoryOnly) + .OrderByDescending(d => d, StringComparer.OrdinalIgnoreCase); + foreach (var pyRoot in pyRoots) + { + string uvExe = Path.Combine(pyRoot, "Scripts", "uv.exe"); + if (File.Exists(uvExe) && ValidateUvBinary(uvExe)) return uvExe; + } + } + } + } + catch { } + candidates = new[] { // Preferred: WinGet Links shims (stable entrypoints)