Skip to content

Commit c27b8bf

Browse files
authored
Merge pull request #253 from dsarno/fix/winstore-uv-detection
Fix/winstore uv detection
2 parents b22f3e3 + 96326ee commit c27b8bf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

UnityMcpBridge/Editor/Helpers/ServerInstaller.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Runtime.InteropServices;
44
using System.Text;
55
using System.Collections.Generic;
6+
using System.Linq;
67
using UnityEditor;
78
using UnityEngine;
89

@@ -569,6 +570,31 @@ internal static string FindUvPath()
569570
}
570571
catch { }
571572

573+
// Windows Store (PythonSoftwareFoundation) install location probe
574+
// Example: %LOCALAPPDATA%\Packages\PythonSoftwareFoundation.Python.3.13_*\LocalCache\local-packages\Python313\Scripts\uv.exe
575+
try
576+
{
577+
string pkgsRoot = Path.Combine(localAppData, "Packages");
578+
if (Directory.Exists(pkgsRoot))
579+
{
580+
var pythonPkgs = Directory.GetDirectories(pkgsRoot, "PythonSoftwareFoundation.Python.*", SearchOption.TopDirectoryOnly)
581+
.OrderByDescending(p => p, StringComparer.OrdinalIgnoreCase);
582+
foreach (var pkg in pythonPkgs)
583+
{
584+
string localCache = Path.Combine(pkg, "LocalCache", "local-packages");
585+
if (!Directory.Exists(localCache)) continue;
586+
var pyRoots = Directory.GetDirectories(localCache, "Python*", SearchOption.TopDirectoryOnly)
587+
.OrderByDescending(d => d, StringComparer.OrdinalIgnoreCase);
588+
foreach (var pyRoot in pyRoots)
589+
{
590+
string uvExe = Path.Combine(pyRoot, "Scripts", "uv.exe");
591+
if (File.Exists(uvExe) && ValidateUvBinary(uvExe)) return uvExe;
592+
}
593+
}
594+
}
595+
}
596+
catch { }
597+
572598
candidates = new[]
573599
{
574600
// Preferred: WinGet Links shims (stable entrypoints)

0 commit comments

Comments
 (0)