parent
bd8dbbf4c5
commit
55b0b19135
2 changed files with 5 additions and 4 deletions
|
|
@ -227,7 +227,7 @@ impl Page {
|
|||
directories.get(0).expect("Always at least one directory");
|
||||
|
||||
_ = std::fs::create_dir_all(directory_to_target.as_path());
|
||||
|
||||
|
||||
if let Ok(exists) = std::fs::exists(directory_to_target.join(file_name.clone())) {
|
||||
if !exists {
|
||||
// when adding an application, we want to symlink to be more user-friendly
|
||||
|
|
|
|||
|
|
@ -562,15 +562,16 @@ impl<'a> TryFrom<Cow<'a, Path>> for Applet<'static> {
|
|||
|
||||
fn try_from(path: Cow<'a, Path>) -> Result<Self, Self::Error> {
|
||||
let content = std::fs::read_to_string(path.as_ref())?;
|
||||
let entry = DesktopEntry::from_str(path.as_ref(), &content, None::<&[&str]>)?;
|
||||
let languages = freedesktop_desktop_entry::get_languages_from_env();
|
||||
let entry = DesktopEntry::from_str(path.as_ref(), &content, Some(&languages))?;
|
||||
if entry.desktop_entry("X-CosmicApplet").is_none() {
|
||||
anyhow::bail!("Not an applet");
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
id: Cow::from(entry.id().to_string()),
|
||||
name: Cow::from(entry.name::<&str>(&[]).unwrap_or_default().to_string()),
|
||||
description: Cow::from(entry.comment::<&str>(&[]).unwrap_or_default().to_string()),
|
||||
name: Cow::from(entry.name(&languages).unwrap_or_default().to_string()),
|
||||
description: Cow::from(entry.comment(&languages).unwrap_or_default().to_string()),
|
||||
icon: Cow::from(entry.icon().unwrap_or_default().to_string()),
|
||||
path: Cow::from(path.into_owned()),
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue