Fix Rekordbox USB Access in macOS Sandbox (#13624)#16237
Fix Rekordbox USB Access in macOS Sandbox (#13624)#16237xARSENICx wants to merge 2 commits intomixxxdj:2.6from
Conversation
0d9bc86 to
52b3f2b
Compare
52b3f2b to
a9e834b
Compare
|
@JoergAtGithub This requires review as well. Can this be triaged too? |
ghztomash
left a comment
There was a problem hiding this comment.
Nice!
I could try giving this a spin in the next days, unfortunately the macBook I have can only read SD cards.
|
|
||
| if (!savedDbFile.isEmpty()) { | ||
| mixxx::FileInfo dbFileInfo(savedDbFile); | ||
| if (Sandbox::canAccess(&dbFileInfo) && dbFileInfo.checkFileExists()) { |
There was a problem hiding this comment.
What would happen if a different USB is plugged in? Is it safe to assume that checkFileExists will fail and the dialog will appear again?
There was a problem hiding this comment.
You're absolutely right. Currently, checkFileExists will fail for a different USB, which will trigger the QFileDialog again. This allows the user to 'switch' access to the new USB, but it will overwrite the previously saved path in SettingsDAO. This means if they plug the first USB back in later, they'll have to go through the picker again. It’s functional but not yet persistent for multiple devices.
| QString newDbFile = QFileDialog::getOpenFileName(nullptr, | ||
| tr("Select your Rekordbox external database"), | ||
| defaultPath, | ||
| "Rekordbox Database (export.pdb)"); |
There was a problem hiding this comment.
Would this allow access only to a single USB at a time?
There was a problem hiding this comment.
Correct. Because the macOS Sandbox restricts access to the entire /Volumes directory, findRekordboxDevices() can't automatically discover other drives. Since we are currently only storing a single path in the settings, only one USB can be 'unlocked' and visible at a time.
I agree this is a significant limitation for DJs who use multiple Rekordbox devices simultaneously. I'm looking into expanding this to store a list of persistent paths/bookmarks to support multiple simultaneous USBs.
I really appreciate your review. Thanks.
Store bookmarked USB paths as a semicolon-delimited list instead of a single path (mixxx.rekordboxfeature.sandboxed_usb_paths). On activate(), all stored paths are validated and each accessible one contributes a volume root to the device scan. The file picker only appears when no previously bookmarked USB is currently plugged in. Addresses review feedback that previous single-path approach would limit sandboxed access to one USB at a time.
f075349 to
695b4e0
Compare
Fix Rekordbox USB Access in macOS Sandbox (Issue #13624)
Summary
This PR fixes an issue where Mixxx, when running in a sandboxed macOS environment, was unable to discover Rekordbox USB drives because the
/Volumesdirectory is restricted. It implements a manual file picker fallback and uses Security Scoped Bookmarks to persist access permissions across multiple devices and restarts. This is based on the ideas used in #16205.The Problem
When Mixxx is sandboxed on macOS (e.g., Mac App Store builds or with sandbox entitlements enabled), it does not have permission to read the contents of
/Volumesby default. As a result, the automatic scanning logic infindRekordboxDevices()fails to discover Rekordbox exported databases on external USB or SD devices, leading to a blank interface or "Rekordbox USB not working" issues.Unlike Traktor (which reads a single, static
collection.nml), Rekordbox is designed around multiple external disks. A DJ commonly has several USB sticks/SD cards plugged in simultaneously. This means the fix needs to handle multiple devices, not just one.The Solution
Based on the logic used for the Traktor sandbox fix (#16205):
RekordboxFeature::activate()to prompt the user to manually select theirexport.pdbfile via a nativeQFileDialogif no previously bookmarked USB is currently accessible.NSOpenPanel, which explicitly grants Mixxx permission to read the chosen directory.Sandbox::createSecurityToken()to create a Security Scoped Bookmark per device, ensuring permissions persist across application restarts without re-prompting.;-delimited list inSettingsDAO(mixxx.rekordboxfeature.sandboxed_usb_paths). On eachactivate(), all stored paths are validated against the current filesystem — those that are currently plugged in are passed to the scanner, and stale entries are ignored until the device is reconnected.findRekordboxDevices()to accept aQStringListof manually granted volume roots. All accessible USBs appear in the sidebar simultaneously.Changes
src/library/rekordbox/rekordboxfeature.cpp:#include <QFileDialog>andSettingsDAOfor configuration and UI.activate()to validate and iterate all stored USB paths, prompting the picker only when none are currently accessible.findRekordboxDevices()to accept aQStringListof manual paths instead of a singleQString, enabling multiple simultaneous Rekordbox USBs in the sidebar.engine.h,color.h,waveform.h).Verification Required
Fixes: #13624