fix #220: the first entry is not necessarily a directory

in that case, we use dirname() on the first entry
Merge pull request #488 from yihui/bugfix/220

fix #220: the first entry in zip is not necessarily a directory