Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.12.5, 5.12, 5.13.1
-
None
-
macOS 10.15 and 10.14
Description
QStorageInfo.mountedVolumes() does not detect volumes mounted via /etc/fstab orĀ /etc/auto_master. As far as I can it only detects network mounts created via Finder.
Here is a link to the relative section of code.
The problem is in the option kCFURLEnumeratorSkipInvisibles. Using virtually any other option in the CFURLEnumeratorOptions results in a complete listing of mounts.
I was able to recreate the Qt behavior in a Swift playground file with the following contents
import Cocoa let options = CFURLEnumeratorOptions.skipInvisibles let volumes = CFURLEnumeratorCreateForMountedVolumes(nil, options, nil)! var paths = [CFString]() var result = CFURLEnumeratorResult.success var urlProperty : Unmanaged<CFURL>? var errorProperty : Unmanaged<CFError>? repeat { result = CFURLEnumeratorGetNextURL(volumes, &urlProperty, &errorProperty) if result == CFURLEnumeratorResult.success { if urlProperty != nil { let unpackagedUrl = urlProperty!.takeRetainedValue() as CFURL let urlString = CFURLCopyFileSystemPath(unpackagedUrl, CFURLPathStyle.cfurlposixPathStyle) paths.append(urlString!) } } } while result != CFURLEnumeratorResult.end print(paths)
Here is a link to all the possible options that CFUrlEnumeratorCreateForMountedVolumes can be called with: https://developer.apple.com/documentation/corefoundation/cfurlenumeratoroptions
I suggest a different option is considered such as skipPackageContents.
Another quick sanity check is to mount a network share via /etc/fstab or /etc/auto_master and then run mount from the terminal, and compare that to the output of QStorageInfo.mountedVolumes().