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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com