The name `getParent()` is a bit misleading. For files, this returns the parent directory. For directories (which end with "/"), this returns the passed in directory, and _not_ the parent.

How about calling this `getDirectoryPath`?