Use dir_path instead of dirname.