SMBMounter icon indicating copy to clipboard operation
SMBMounter copied to clipboard

Shares with space in name not detected as mounted

Open FlyingDiver opened this issue 4 months ago • 3 comments

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.

FlyingDiver avatar Jul 23 '26 15:07 FlyingDiver

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

KeepCoolCH avatar Jul 23 '26 16:07 KeepCoolCH

That works. Thanks.

FlyingDiver avatar Jul 23 '26 16:07 FlyingDiver

Great. 😇

KeepCoolCH avatar Jul 23 '26 16:07 KeepCoolCH