pub fn find_entry_by_app_name(
    dir_path: &Path,
    app_name: &OsStr,
) -> Option<(FreeDesktopEntry, PathBuf)> {
    for entry in dir_path.read_dir().ok()?.filter_map(Result::ok) {
        let entry_path = entry.path();
        // If it is a file we open it
        if entry_path.is_file() {
            if let Ok(parsed) = parse_entry(&entry_path) {
                if parsed
                    .section("Desktop Entry")
                    .attr("Name")
                    .map(str::as_ref)
                    == Some(app_name)
                {
                    return Some((parsed, entry_path));
                }
            }
        } else if entry.path().is_dir() {
            // Recursively keep searching if it is a directory
            if let Some(result) = find_entry_by_app_name(&entry_path, app_name) {
                return Some(result);
            }
        }
    }
    None
}
/// Returns the first FreeDesktop XDG .desktop entry, found inside `dir_path`, when the
/// "Name" atribute of that entry is `app_name`.
///
/// The return value is actually a tuple containing the entry itself, and the path at which
/// it was found.
Returns the first FreeDesktop XDG .desktop entry, found inside `dir_path`, when the
"Name" atribute of that entry is `app_name`.

The return value is actually a tuple containing the entry itself, and the path at which
it was found.
Returns the first FreeDesktop XDG . desktop entry found inside ` dir_path ` when the " Name " atribute of that entry is ` app_name ` . The return value is actually a tuple containing the entry itself and the path at which it was found .
pub fn find_entry_by_app_name(
    dir_path: &Path,
    app_name: &OsStr,
) -> Option<(FreeDesktopEntry, PathBuf)> {
    for entry in dir_path.read_dir().ok()?.filter_map(Result::ok) {
        let entry_path = entry.path();
        // If it is a file we open it
        if entry_path.is_file() {
            if let Ok(parsed) = parse_entry(&entry_path) {
                if parsed
                    .section("Desktop Entry")
                    .attr("Name")
                    .map(str::as_ref)
                    == Some(app_name)
                {
                    return Some((parsed, entry_path));
                }
            }
        } else if entry.path().is_dir() {
            // Recursively keep searching if it is a directory
            if let Some(result) = find_entry_by_app_name(&entry_path, app_name) {
                return Some(result);
            }
        }
    }
    None
}
pub fn find_entry_by_app_name ( dir_path : & Path , app_name : & OsStr , ) -> Option < ( FreeDesktopEntry , PathBuf ) > { for entry in dir_path . read_dir ( ) . ok ( ) ? . filter_map ( Result :: ok ) { let entry_path = entry . path ( ) ; // If it is a file we open it if entry_path . is_file ( ) { if let Ok ( parsed ) = parse_entry ( & entry_path ) { if parsed . section ( " " ) . attr ( " " ) . map ( str :: as_ref ) == Some ( app_name ) { return Some ( ( parsed , entry_path ) ) ; } } } else if entry . path ( ) . is_dir ( ) { // Recursively keep searching if it is a directory if let Some ( result ) = find_entry_by_app_name ( & entry_path , app_name ) { return Some ( result ) ; } } } None }
Returns the first FreeDesktop XDG .desktop entry, found inside `dir_path`, when the
"Name" atribute of that entry is `app_name`.
Returns the first FreeDesktop XDG . desktop entry found inside ` dir_path ` when the " Name " atribute of that entry is ` app_name ` .
dir_path
&Path
app_name
&OsStr