Or you could pass the source path into your script and check the path there.
That's actually probably a simpler / cleaner solution. Sure you fire off a DNR when you don't need to most of the time, but the code could easily exit quickly if the path of the deployed file(s) doesn't match what needs to be processed.I'm [almost] ashamed I didn't think of that :-)