I have an OS X application that lets the user select any folder. I need to somehow share that selected folder on the network. I have been doing research for a while on how to share a folder usi开发者_开发问答ng Objective-C; nothing helped.
If you're referring to the built-in (AFP/SMB) File Sharing service, you can use the Open Directory framework to edit records of type kODRecordTypeSharePoints
. Your best bet is to examine what System Preferences does when you add a share point and just copy that format. You can use dscl
to examine it, for example:
% dscl . -list /SharePoints
Previous iTunes Libraries
% dscl . -read '/SharePoints/Previous iTunes Libraries'
dsAttrTypeNative:afp_guestaccess: 1
dsAttrTypeNative:afp_name:
Previous iTunes Libraries
dsAttrTypeNative:afp_shared: 1
dsAttrTypeNative:directory_path:
/Users/nicholas/Music/iTunes/Previous iTunes Libraries
dsAttrTypeNative:ftp_name:
Previous iTunes Libraries
dsAttrTypeNative:sharepoint_group_id: 33FBCB64-3B80-4E8E-A262-CC2D885A0B0E
dsAttrTypeNative:smb_createmask: 644
dsAttrTypeNative:smb_directorymask: 755
dsAttrTypeNative:smb_guestaccess: 1
dsAttrTypeNative:smb_name:
Previous iTunes Libraries
dsAttrTypeNative:smb_shared: 1
AppleMetaNodeLocation: /Local/Default
RecordName:
Previous iTunes Libraries
RecordType: dsRecTypeStandard:SharePoints
dscl
also has an interactive mode which is more useful for exploring.
精彩评论