Fixed parent path for relative paths

Fixes #156 - broken filenames while using relative paths. The cause for the problem was that a `dirname` of a root in a relative path is `.` not `/` and since `parent.name` wasn't equal to  `__root__/` for files in a root directory, it stripped the first two characters (the length of `./`) off its name.