• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File modification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File modification


  • Subject: Re: File modification
  • From: David Remahl <email@hidden>
  • Date: Wed, 26 Mar 2003 10:58:15 +0100

On Wednesday, March 26, 2003, at 10:38 AM, Hamish Allan wrote:

Why not using an Interprocess communication solution? (BTW it's great to see that there's a dedicated session to IPC during next WWDC)

The preferences are communicated in both directions. The daemon, when started, determines the settings that the user can choose between; the user chooses between them in the preference pane. Both sets of preferences should be persisted (the system preferences app will not always be running for the daemon to query, and the preference pane allows the daemon to be started and stopped but should still allow the user to choose the settings when stopped).

So I'm figuring that there'll have to be two files anyway, and any interprocess communication will be tantamount to "go and re-read your file", which is superfluous if I can receive notification of file modification. But if there's something obviously wrong with my approach I'd like to take advice.

Communicating using the file system is in most cases a BadIdea.

You could use NSDistributedNotificationCenter to broadcast changes in the preferences.

If you want, you can have the source to iChatStatus, which has a preferences object in common between the pref pane and daemon, which handles all of the details. So when the pref pane wants to set a preference, it just sends [prefsObject setSomePreference:someValue]. That change is then propagated to the corresponding object in the server through distributed notifications, and the daemon can read preferences using [prefsObject somePreference]. It works fine. Mail me if you're interested in the code.

To answer your original question, you will have to use FNNotify from Carbon to be notified of file system changes. I have a rudimentary ObjC wrapper for that, if you're interested. <http://ittpoi.com/drfns.tgz>. There is some discussion on file notifications on this page: <http://cocoadev.com/index.pl?FilesystemNotifications>.

/ Rgds, David
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: File modification (From: Hamish Allan <email@hidden>)

  • Prev by Date: Re: To someone at Apple
  • Next by Date: [OT] Projects management tools
  • Previous by thread: Re: File modification
  • Next by thread: Re: File modification
  • Index(es):
    • Date
    • Thread