Skip to content

fix(finder): observe mounted volumes and their lifecycle to support external/network drives (fixes #148, #150) - #152

Merged
wflixu merged 1 commit into
wflixu:devfrom
Juns-g:fix/external-drives-volumes-observation
Sep 13, 2026
Merged

wflixu merged 1 commit into
wflixu:devfrom
Juns-g:fix/external-drives-volumes-observation

Conversation

@Juns-g

@Juns-g Juns-g commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #148
Fixes #150

Currently, setupObservingDirectories() in FinderSyncExt only registers ["/"]. In macOS's VFS architecture, external drives, mounted DMGs, and network shares (SMB/NFS/AFP) reside under /Volumes/<VolumeName>, which are separate file system mount points not covered by root volume-only observation in FinderSync. As a result, right-click context menus fail to appear on external or network volumes.

This PR fixes this by:

  1. Explicitly registering both / and each currently mounted volume (FileManager.default.mountedVolumeURLs).
  2. Adding MountedVolumeObserver to dynamically listen to NSWorkspace.didMountNotification, didUnmountNotification, and didRenameVolumeNotification on NSWorkspace.shared.notificationCenter.
  3. Updating FIFinderSyncController.default().directoryURLs incrementally to prevent stale references when drives are mounted/unmounted at runtime.

Type of Change

  • 🐛 Bug fix
  • 🧪 Test addition/update
  • 📝 Documentation update

Related Issue

Closes #148
Closes #150

Testing

Manual Testing

  • Tested with real mounted DMG: dynamically added to observation list upon mount and pruned on unmount.
  • Verified FinderSync extension loads properly with updated directory URLs.

Build Verification

xcodebuild -project RClick.xcodeproj -scheme RClick -destination 'platform=macOS'
xcodebuild test -project RClick.xcodeproj -scheme RClick -destination 'platform=macOS'

All unit tests pass including the new MountedVolumeObserverTests.

Checklist

  • My code follows the project's Swift 6.2 conventions (see CONTRIBUTING.md)
  • All UI is SwiftUI (no AppKit UI components)
  • I have tested on macOS 15.6+
  • I have updated documentation if needed
  • My branch is up-to-date with dev

Register each mounted volume explicitly and apply workspace mount, unmount and rename paths without trusting stale unmount enumeration. Add lifecycle regression coverage and document the real DMG probe and remaining signed Finder verification.

Fixes wflixu#148

Fixes wflixu#150
@wflixu
wflixu merged commit bed1621 into wflixu:dev Sep 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants