(ctx: &mut ScriptContext<'_, API>)
| 3668 | RowIndicator::None |
| 3669 | } |
| 3670 | } |
| 3671 | |
| 3672 | pub fn file_path_tree_visible(path: &str, expanded_paths: &[String]) -> bool { |
| 3673 | let parent = parent_res_folder(path); |
| 3674 | if parent.is_empty() { |
| 3675 | return true; |
| 3676 | } |
| 3677 | file_ancestor_folders(path) |
| 3678 | .into_iter() |
| 3679 | .all(|folder| expanded_paths.iter().any(|item| item == &folder)) |
| 3680 | } |
| 3681 | |
| 3682 | pub fn file_ancestor_folders(path: &str) -> Vec<String> { |
| 3683 | let mut out = Vec::new(); |
| 3684 | let mut cursor = parent_res_folder(path); |
| 3685 | while !cursor.is_empty() { |
| 3686 | out.push(cursor.clone()); |
| 3687 | cursor = parent_res_folder(&cursor); |
| 3688 | } |
| 3689 | out.reverse(); |
| 3690 | out |
| 3691 | } |
| 3692 | |
| 3693 | pub fn file_path_depth(path: &str) -> usize { |
| 3694 | file_ancestor_folders(path).len() |
| 3695 | } |
| 3696 | |
| 3697 | pub fn file_base_name(path: &str) -> String { |
| 3698 | let rel = editor_files::rel_label(path); |
| 3699 | if rel.is_empty() { |
| 3700 | return "res://".to_string(); |
| 3701 | } |
| 3702 | rel.trim_end_matches('/') |
| 3703 | .rsplit('/') |
| 3704 | .next() |
| 3705 | .unwrap_or(rel.as_str()) |
| 3706 | .to_string() |
| 3707 | } |
| 3708 | |
| 3709 | pub fn file_path_matches_filter(path: &str, filter: &NodePickerFilter) -> bool { |
| 3710 | let hay = format!( |
no test coverage detected