Make a copy of a filename passed to DirectoryContaining()

According to IEEE Std 1003.1, dirname() MAY modify the received value.
http://pubs.opengroup.org/onlinepubs/009604599/functions/dirname.html
Merge pull request #18 from steelman/for-mmp

Make a copy of a filename passed to DirectoryContaining()