In case of the path being a real file, aren't you uselessly creating a temp file?