The method returns an undefined value for isDirectory if the path does not exist.
Initialize isDirectory and make sure the file exists before returning a value. Else return false.