added possibility to open a directory instead of a file IN the
directory.