Skip to content

Commit 48d912e

Browse files
committed
Follow-up: address CodeRabbit feedback for #308 (<GetToolsFolderIdentifier was duplicated>)
1 parent f713810 commit 48d912e

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

MCPForUnity/Editor/Helpers/PackageDetector.cs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private static bool ToolsVersionsChanged()
152152
}
153153

154154
// Get folder identifier (same logic as ServerInstaller.GetToolsFolderIdentifier)
155-
string folderIdentifier = GetToolsFolderIdentifier(folder);
155+
string folderIdentifier = ServerInstaller.GetToolsFolderIdentifier(folder);
156156
string trackingFile = System.IO.Path.Combine(toolsDir, $"{folderIdentifier}_version.txt");
157157

158158
// Read installed version
@@ -177,39 +177,5 @@ private static bool ToolsVersionsChanged()
177177
return true;
178178
}
179179
}
180-
181-
/// <summary>
182-
/// Generates a unique identifier for a MCPForUnityTools folder (duplicates ServerInstaller logic).
183-
/// </summary>
184-
private static string GetToolsFolderIdentifier(string toolsFolderPath)
185-
{
186-
try
187-
{
188-
System.IO.DirectoryInfo parent = System.IO.Directory.GetParent(toolsFolderPath);
189-
if (parent == null) return "MCPForUnityTools";
190-
191-
System.IO.DirectoryInfo current = parent;
192-
while (current != null)
193-
{
194-
string name = current.Name;
195-
System.IO.DirectoryInfo grandparent = current.Parent;
196-
197-
if (grandparent != null &&
198-
(grandparent.Name.Equals("Assets", System.StringComparison.OrdinalIgnoreCase) ||
199-
grandparent.Name.Equals("Packages", System.StringComparison.OrdinalIgnoreCase)))
200-
{
201-
return $"{name}_MCPForUnityTools";
202-
}
203-
204-
current = grandparent;
205-
}
206-
207-
return $"{parent.Name}_MCPForUnityTools";
208-
}
209-
catch
210-
{
211-
return "MCPForUnityTools";
212-
}
213-
}
214180
}
215181
}

MCPForUnity/Editor/Helpers/ServerInstaller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ private static void CopyUnityProjectTools(string destToolsDir)
495495
/// Generates a unique identifier for a MCPForUnityTools folder based on its parent directory.
496496
/// Example: "Assets/MooseRunner/Editor/MCPForUnityTools" → "MooseRunner_MCPForUnityTools"
497497
/// </summary>
498-
private static string GetToolsFolderIdentifier(string toolsFolderPath)
498+
internal static string GetToolsFolderIdentifier(string toolsFolderPath)
499499
{
500500
try
501501
{

0 commit comments

Comments
 (0)