File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
MCPForUnity/Editor/Helpers Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments