changing when_dir_exist_add_path into a hidden function