fix(editor): only treat dev mode when manifest uses file: path for package; remove dev-mode logs under UPM
parent
57592017ae
commit
85202d4ccb
|
|
@ -945,32 +945,23 @@ namespace UnityMcpBridge.Editor.Windows
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Check if we're using a file-based package by looking at the manifest
|
// Only treat as development if manifest explicitly references a local file path for the package
|
||||||
string manifestPath = Path.Combine(Application.dataPath, "..", "Packages", "manifest.json");
|
string manifestPath = Path.Combine(Application.dataPath, "..", "Packages", "manifest.json");
|
||||||
if (File.Exists(manifestPath))
|
if (!File.Exists(manifestPath)) return false;
|
||||||
|
|
||||||
|
string manifestContent = File.ReadAllText(manifestPath);
|
||||||
|
// Look specifically for our package dependency set to a file: URL
|
||||||
|
// This avoids auto-enabling dev mode just because a repo exists elsewhere on disk
|
||||||
|
if (manifestContent.IndexOf("\"com.justinpbarnett.unity-mcp\"", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||||
{
|
{
|
||||||
string manifestContent = File.ReadAllText(manifestPath);
|
int idx = manifestContent.IndexOf("com.justinpbarnett.unity-mcp", StringComparison.OrdinalIgnoreCase);
|
||||||
// Look for file-based package reference
|
// Crude but effective: check for "file:" in the same line/value
|
||||||
if (manifestContent.Contains("file:/") && manifestContent.Contains("unity-mcp"))
|
if (manifestContent.IndexOf("file:", idx, StringComparison.OrdinalIgnoreCase) >= 0
|
||||||
|
&& manifestContent.IndexOf("\n", idx, StringComparison.OrdinalIgnoreCase) > manifestContent.IndexOf("file:", idx, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also check if we're in a development environment by looking for common dev paths
|
|
||||||
string[] devIndicators = {
|
|
||||||
Path.Combine(Application.dataPath, "..", "unity-mcp"),
|
|
||||||
Path.Combine(Application.dataPath, "..", "..", "unity-mcp"),
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (string indicator in devIndicators)
|
|
||||||
{
|
|
||||||
if (Directory.Exists(indicator) && File.Exists(Path.Combine(indicator, "UnityMcpServer", "src", "server.py")))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue