fix for paths like/begin with './'
Merge remote-tracking branch 'mirkolofio/master' into dev
Move realpath call into constructor

Add an is_dir check, because realpath fails with things like stream wrappers