Removing the directory logic from getPathname and creating getDirectory.