Re: Programmatically create aliases to unmounted servers?
Re: Programmatically create aliases to unmounted servers?
- Subject: Re: Programmatically create aliases to unmounted servers?
- From: John Joyce <email@hidden>
- Date: Tue, 24 Jan 2012 20:17:10 -0600
What you might want to do is create an AppleScript that is maybe run-only and is on the desktop.
Way less pain.
On Jan 24, 2012, at 4:24 PM, Zajkowski, James wrote:
> All,
>
> I'm looking for a way to construct an alias file (a bookmark file) with a specific but unmounted file server location. That is, I want to put an icon on user's desktops that says "Network Space" and have it resolve to afp://ser.ver.add.ress/mount/username.
>
> I can create an NSURL with the encoded path correctly, and I've tried to construct a bookmark file using NSURL's -bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error: and + writeBookmarkData:toURL:options:error:. When I use a "smb" or "afp" URL I get a file that, when double clicked, opens in TextEdit with the contents of the bookmark file (that is, the URL). I'm pretty sure my code is correct because if I change the URL to a local file I get a working bookmark file. It also works if I construct the URL to a local path when the server is mounted (/Volumes/Server) - unmounting and opening the bookmark will re-mount the server.
>
> I've stared at the NSURL and File Manager references and it seems like there's no way to go from a text server reference to a bookmark file. Is there a way to make an alias without mounting the server first?
>
> Thanks,
>
> --Jim
>
_______________________________________________
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