That's a very good point - I hadn't thought of that!
However, this plugin as-is (without the changes I made) wasn't too usable for me, as I would've had to set the ftp configuration for every subdirectory of my 'ad hoc' project - as far as I know, anyway.
Perhaps there's a way to support both - what about checking to see if TM_PROJECT_DIRECTORY is a prefix of TM_PROJECT_FILEPATH (i.e. the current file is within the project directory); if so, then all is well; otherwise, the situation you describe has occurred, and it's best to use dirname(TM_PROJECT_FILEPATH).
More information about formatting options