A More User-Friendly FSResolveAlias/WithMountFlags()
A More User-Friendly FSResolveAlias/WithMountFlags()
- Subject: A More User-Friendly FSResolveAlias/WithMountFlags()
- From: Jerry Krinock <email@hidden>
- Date: Wed, 1 Jul 2009 11:59:58 -0700
To resolve a file alias, I use FSResolveAlias(), or
FSResolveAliasWithMountFlags().
If the target file is on a server which is not available, when
allowing user interaction, these non-cancellable synchronous functions
cause my app to beachball for 30 seconds (or longer if the server
recently disappeared without being ejected), and then it displays a
dialog box: "The server seems to be not operational...".
To put a more reasonable timeout on it and return a nice NSError, or
make it cancellable, ^and^ be able to kill it so that it won't display
its annoying dialog long after we've given up on it, I believe that I
need to wrap it in a helper tool and launch it using NSTask.
Is there any better way to resolve aliases? Has anyone already done it?
I tried NDAlias but it uses FSResolvAliasWithMountFlags() and thus has
the same behavior. I need the user interaction for connecting to the
server (mountFlags = 0).
Sincerely,
Jerry Krinock
P.S. May be off topic, but probably only Alias gurus have read this
far anyhow. Does anyone know how to tweeze the server name out of an
alias record's data? I can see it in there, and the documentation of
the depracated function GetAliasInfo() says it can get it. But the
replacement function, FSCopyAliasInfo(), does not seem to have this
capability. Server name is not returned in any of its by-reference
parameters, and the FSAliasInfo struct does not include a server name
field either.
I considered using statfs(2). If I give statfs() a "/Volumes/
ServerVolume/…" path, the mntfromname field of the returned struct is
a C string, for example:
afp_2lZ2Za000bB10000oM0000VU-1.2e00002e
I'd bet that those characters would identify the server if someone
could explain how to decode it.
The reason I want the server name is because my application allows
users to import/export similarly-named files on different volumes and
servers. In this situation, volume names are often ambiguous. I
would like to display the server name also, so that the user knows
clearly what data they're operating upon.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden