@@ -399,17 +399,19 @@ final class FileOperationCoordinator: NSObject, NSSharingServiceDelegate {
399399 try await TerminalDirectoryLauncher . open ( directory , with : application ,
400400 applicationURL : applicationURL , mode : mode )
401401
402- case . resource ( let tool , let selection ) :
402+ case . resource ( let tool , let items ) :
403+ let selection = items . map ( \. source )
403404 guard ResourceToolsPolicy . availableTools ( selection : selection , isItemMenu : true ,
404405 preferences : currentPreferences ) . contains ( tool ) else { throw ResourceError . disabled }
405406 var bookmarks : [ String : Data ] = [ : ]
406407 guard try authorizeParents ( of : selection , bookmarks : & bookmarks , readOnly : true ) else { return }
407408 try requireResolvedSelection ( selection )
408409 guard ResourceToolsPolicy . availableTools ( selection : selection , isItemMenu : true ,
409410 preferences : currentPreferences ) . contains ( tool ) else { throw ResourceError . disabled }
410- try await resourceController . present ( selection : selection , tool : tool )
411+ try await resourceController . present ( selection : selection , tool : tool , expected : items )
411412
412- case . prepare ( let selection ) :
413+ case . prepare ( let items ) :
414+ let selection = items . map ( \. source )
413415 guard FileToolsPolicy . availableTools ( selection : selection , isItemMenu : true ,
414416 preferences : currentPreferences ) . contains ( . move ) else { throw FileMoveError . disabled }
415417 var bookmarks : [ String : Data ] = [ : ]
@@ -419,8 +421,8 @@ final class FileOperationCoordinator: NSObject, NSSharingServiceDelegate {
419421 preferences : currentPreferences ) . contains ( . move ) else { throw FileMoveError . disabled }
420422 let store = self . store
421423 try await Task . detached ( priority : . userInitiated ) {
422- let pending = try PendingFileMove . capture ( selection : selection )
423- try store . save ( pending )
424+ let pending = try PendingFileMove . validate ( captured : items )
425+ try store . replaceSelection ( pending )
424426 } . value
425427
426428 case . permanentDelete ( let items , let confirmation ) :
@@ -701,6 +703,22 @@ final class FileOperationCoordinator: NSObject, NSSharingServiceDelegate {
701703 return
702704 }
703705 if let error = error as? FileMoveError {
706+ if case . restoreBlocked ( let staged , let destination ) = error {
707+ let alert = NSAlert ( )
708+ alert . messageText = text ( . moveFailed )
709+ alert . informativeText = String ( format : text ( . moveRestoreBlocked ) , staged . path , destination . path )
710+ NSApp . activate ( ignoringOtherApps : true )
711+ alert . runModal ( )
712+ return
713+ }
714+ if case . retryDestination ( let destination ) = error {
715+ let alert = NSAlert ( )
716+ alert . messageText = text ( . moveFailed )
717+ alert . informativeText = String ( format : text ( . moveRetryDestination ) , destination . path )
718+ NSApp . activate ( ignoringOtherApps : true )
719+ alert . runModal ( )
720+ return
721+ }
704722 if let recovery = error . recoveryURL {
705723 let alert = NSAlert ( )
706724 alert . messageText = text ( . moveFailed )
@@ -712,6 +730,10 @@ final class FileOperationCoordinator: NSObject, NSSharingServiceDelegate {
712730 let key : FileMintTextKey = switch error {
713731 case . invalidSelection : . moveInvalidSelection
714732 case . sourceChanged : . moveSourceChanged
733+ case . copiedSourceRetained : . moveCopiedSourceRetained
734+ case . retryDestination : . moveRetryDestination
735+ case . restoreBlocked : . moveRestoreBlocked
736+ case . sourceRestored : . moveSourceRestored
715737 case . invalidDestination : . moveInvalidDestination
716738 case . destinationExists : . moveDestinationExists
717739 case . staleRequest : . moveStaleRequest
0 commit comments