Skip to content

Commit 6a4d55b

Browse files
Update MCPForUnity/Editor/Helpers/ServerInstaller.cs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 88a6491 commit 6a4d55b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

MCPForUnity/Editor/Helpers/ServerInstaller.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ private static void CopyUnityProjectTools(string destToolsDir)
488488
continue;
489489
}
490490

491+
bool copyFailed = false;
491492
foreach (var pyFile in pyFiles)
492493
{
493494
string fileName = Path.GetFileName(pyFile);
@@ -502,17 +503,21 @@ private static void CopyUnityProjectTools(string destToolsDir)
502503
catch (Exception ex)
503504
{
504505
McpLog.Warn($"Failed to copy {fileName}: {ex.Message}");
506+
copyFailed = true;
505507
}
506508
}
507509

508-
// Update version tracking file
509-
try
510+
// Update version tracking file only on full success
511+
if (!copyFailed)
510512
{
511-
File.WriteAllText(versionTrackingFile, sourceVersion);
512-
}
513-
catch (Exception ex)
514-
{
515-
McpLog.Warn($"Failed to write version tracking file for {folderIdentifier}: {ex.Message}");
513+
try
514+
{
515+
File.WriteAllText(versionTrackingFile, sourceVersion);
516+
}
517+
catch (Exception ex)
518+
{
519+
McpLog.Warn($"Failed to write version tracking file for {folderIdentifier}: {ex.Message}");
520+
}
516521
}
517522
}
518523
else

0 commit comments

Comments
 (0)