Expand environment variables before checking existence of file and directory.