XPLAT folder item and server mounting issues

I’ve posted about this before, and have tried using Christian’s MBS plugins, but I’m struggling. Looking for advice.

I have a customer project that is effectively a hot folder watcher. The folders may be on servers, in which case, they want to a) test if the server url + user name + password will connect, and b) auto-mount when the path isn’t available.

Best I can tell, I need to store a reference to the folder item in Xojo + the mount parameters.

The problems I’ve had are the following:

  1. When I try to mount the share, it can come up with a different volume name on Mac (even if it’s not currently mounted), so the mount comes back successful, but the path doesn’t align with what I stored. This happens when I use the MBS async methods.

  2. When using the non async methods, the OS hangs the app for about 90 seconds trying to connect, and there is seemingly no way to kill that process.

I haven’t dove into the potential issues on Windows yet.

My questions therefore are so far twofold: What’s the right way to store references to paths that are on network shares so that I can recall the share and restore the path or even recognize that a path is the same destination as a share when the volume name has been changed, and what’s the right way to auto-mount a share from Xojo?

I can’t be the first person to run into this.

The NetFSMountMBS class has this MountURLAsyncCompleted event, which passes the list of mount points.

And than you can use those points to get the folder.

The sync mount function also provides MountPoints.

Christian, if I always go from auto mounting, I can do that, but what I’m concerned about is the other way. If the user already has the share mounted, I need to know, and the only way I can see to do that is if the path exists. If it has a changed volume name, then I’ll get a false negative.

Maybe I could help with a mount path property to query the path for a mounted disk.

You mean like

dim f as folderitem
dim s as string = f.MountPathMBS?

Then I’d store f.NativePath and f.MountPathMBS when I know I have to restore a mount in the future? 1) restore, 2) create the Xojo folder item?

Yes, something like this.

MountPathMBS(Volume as FolderItem) as String

like this for Mac + Windows.

that could work.