SMBMounter
SMBMounter copied to clipboard
Shares with space in name not detected as mounted
I don't think this code properly detects a mounted volume with a space in the name:
func isMounted(_ share: SMBShare) -> Bool {
// ... derive baseHost + shareName ...
let vols = FileManager.default.mountedVolumeURLs(
includingResourceValuesForKeys: [.volumeURLForRemountingKey], options: []) ?? []
for vol in vols {
if let r = try? vol.resourceValues(forKeys: [.volumeURLForRemountingKey]).volumeURLForRemounting {
let s = r.absoluteString.lowercased()
if remountURLString(s, matches: share.connectionProtocol) && s.contains(baseHost) && s.contains(shareName) {
return true
}
}
}
return false
}
Mount command for a share reports:
//user@IP-Address/Emby%20Media on /Volumes/Emby Media (smbfs, nodev, nosuid, mounted by xxx)
When I use the tool to mount a share with no space it detects that it's connected properly. When the share has the space, it always thinks it's disconnected.
Hi Thank you for reporting the issue. I resolved it in the new Version 1.3. Please try the new Version. 🙂 Let me know, if it works now. Thank you. Kevin
That works. Thanks.
Great. 😇