Added support for complex file paths

I realize this solution is kind of hacky, but it appears to work in most cases.