27 lines
827 B
Rust
27 lines
827 B
Rust
const DESKTOP_ENTRY: &str = include_str!("../res/com.system76.CosmicPlayer.desktop");
|
|
|
|
pub fn supported_mime_types() -> Vec<String> {
|
|
DESKTOP_ENTRY
|
|
.lines()
|
|
.find_map(|line| line.strip_prefix("MimeType="))
|
|
.map(|mime_types| {
|
|
mime_types
|
|
.split(';')
|
|
.filter(|mime_type| !mime_type.is_empty())
|
|
.map(ToOwned::to_owned)
|
|
.collect()
|
|
})
|
|
.unwrap_or_default()
|
|
}
|
|
|
|
pub fn supported_uri_schemes() -> Vec<String> {
|
|
supported_mime_types()
|
|
.into_iter()
|
|
.filter_map(|mime_type| {
|
|
mime_type
|
|
.strip_prefix("x-scheme-handler/")
|
|
.map(ToOwned::to_owned)
|
|
})
|
|
.chain(["file".to_string(), "http".to_string(), "https".to_string()])
|
|
.collect()
|
|
}
|