• 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: Detecting application bundle being moved
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting application bundle being moved


  • Subject: Re: Detecting application bundle being moved
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 17 Apr 2013 18:07:41 -0500

On Apr 17, 2013, at 5:08 PM, Seth Willits wrote:

> I think I've finally figured out that a couple crash patterns are caused by the user moving my application while it's still running. (I tested it and for some reason Finder wasn't warning me when I moved it, which is kinda odd.)
>
> How and why they're moving it is a bit unclear at the moment, but regardless I'd like to detect it having been moved and throw up an alert and quit/relaunch the app etc so it won't crash later on.
>
> Question is: what's the easiest way to detect it having been moved? I thought I'd get lucky and somewhere there'd be a handy notification, but I don't see one. It looks like I'll have to use the FSEvent API? I'm not a fan of it, so I'm hoping there's a slimmer solution.

You can use kqueue() to monitor a vnode for various modifications.  In this case, you'd monitor the directory which contains your app bundle, since moving it means removing the entry for it from there.  Obviously, not all modifications will be your app being moved, so you'd have to check.

That said, this seems like checking that the user hasn't poured molasses into their computer's vents.  If the user is determined to break their system, there's nothing you'll be able to do to stop them.

Regards,
Ken


_______________________________________________

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

  • Follow-Ups:
    • Re: Detecting application bundle being moved
      • From: Seth Willits <email@hidden>
References: 
 >Detecting application bundle being moved (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: File by index?
  • Next by Date: Re: Detecting application bundle being moved
  • Previous by thread: Detecting application bundle being moved
  • Next by thread: Re: Detecting application bundle being moved
  • Index(es):
    • Date
    • Thread