| Crates.io | mimeapps |
| lib.rs | mimeapps |
| version | 0.1.0 |
| created_at | 2025-12-26 02:46:12.568068+00 |
| updated_at | 2025-12-26 02:46:12.568068+00 |
| description | Cross-platform library for looking up registered applications for a given file path |
| homepage | https://github.com/houqp/kiorg |
| repository | https://github.com/houqp/kiorg |
| max_upload_size | |
| id | 2005172 |
| size | 33,972 |
Cross-platform library for looking up registered applications for a given file path.
mimeapps.list files and desktop entries to find associated applications.NSWorkspace to find applications capable of opening a given file.Add this to your Cargo.toml:
[dependencies]
mimeapps = "0.1.0"
use std::path::Path;
use mimeapps::get_apps_for_file;
fn main() {
let path = Path::new("document.pdf");
let apps = get_apps_for_file(path);
for app in apps {
println!("Application Name: {}", app.name);
println!("Executable Path: {}", app.path);
}
}
The library follows the XDG specification to look up applications:
mimeapps.list files in the following order:
$XDG_CONFIG_HOME/mimeapps.list$XDG_CONFIG_DIRS/mimeapps.list$XDG_DATA_HOME/applications/mimeapps.list$XDG_DATA_DIRS/applications/mimeapps.listdefaults.list (deprecated but still used as fallback)..desktop files and respects NoDisplay and Hidden fields.Uses NSWorkspace's URLsForApplicationsToOpenURL: to retrieve a list of applications that can open the specified file URL.