pub fn install_appdata_and_desktop(
        &self,
        appdata: &PathBuf,
        desktop: &PathBuf,
        prefix: &PathBuf,
    ) -> Option<()> {
        for file in &[appdata, desktop] {
            let path = file.as_path();
            if path.exists() {
                let ttype = "--".to_owned() + path.extension()?.to_str()?;

                let ndir = prefix.join("share").join(if ttype == "--desktop" {
                    "applications"
                } else {
                    "appdata"
                });

                let npath = ndir.join(file.file_name()?);
                std::fs::create_dir_all(&ndir).ok()?;

                if self.podir.exists() {
                    Command::new("msgfmt")
                        .arg(ttype)
                        .args(&["--template", &path.to_str()?])
                        .args(&["-d", &self.podir.as_path().to_str()?])
                        .args(&["-o", &npath.as_path().to_str()?])
                        .status()
                        .ok()?;
                } else {
                    std::fs::copy(&path, &npath.as_path()).ok()?;
                }
            }
        }
        Some(())
    }
// Translate .appdata.xml and .desktop and
// install to share/appdata and share/applications
Translate .appdata.xml and .desktop and
install to share/appdata and share/applications
Translate . appdata . xml and . desktop and install to share / appdata and share / applications
pub fn install_appdata_and_desktop(
        &self,
        appdata: &PathBuf,
        desktop: &PathBuf,
        prefix: &PathBuf,
    ) -> Option<()> {
        for file in &[appdata, desktop] {
            let path = file.as_path();
            if path.exists() {
                let ttype = "--".to_owned() + path.extension()?.to_str()?;
                let ndir = prefix.join("share").join(if ttype == "--desktop" {
                    "applications"
                } else {
                    "appdata"
                });
                let npath = ndir.join(file.file_name()?);
                std::fs::create_dir_all(&ndir).ok()?;
                if self.podir.exists() {
                    Command::new("msgfmt")
                        .arg(ttype)
                        .args(&["--template", &path.to_str()?])
                        .args(&["-d", &self.podir.as_path().to_str()?])
                        .args(&["-o", &npath.as_path().to_str()?])
                        .status()
                        .ok()?;
                } else {
                    std::fs::copy(&path, &npath.as_path()).ok()?;
                }
            }
        }
        Some(())
    }
pub fn install_appdata_and_desktop ( & self , appdata : & PathBuf , desktop : & PathBuf , prefix : & PathBuf , ) -> Option < ( ) > { for file in & [ appdata , desktop ] { let path = file . as_path ( ) ; if path . exists ( ) { let ttype = " " . to_owned ( ) + path . extension ( ) ? . to_str ( ) ? ; let ndir = prefix . join ( " " ) . join ( if ttype == " " { " " } else { " " } ) ; let npath = ndir . join ( file . file_name ( ) ? ) ; std :: fs :: create_dir_all ( & ndir ) . ok ( ) ? ; if self . podir . exists ( ) { Command :: new ( " " ) . arg ( ttype ) . args ( & [ " " , & path . to_str ( ) ? ] ) . args ( & [ " " , & self . podir . as_path ( ) . to_str ( ) ? ] ) . args ( & [ " " , & npath . as_path ( ) . to_str ( ) ? ] ) . status ( ) . ok ( ) ? ; } else { std :: fs :: copy ( & path , & npath . as_path ( ) ) . ok ( ) ? ; } } } Some ( ( ) ) }
Translate .appdata.xml and .desktop and
install to share/appdata and share/applications
Translate . appdata . xml and . desktop and install to share / appdata and share / applications
&self
appdata
&PathBuf
desktop
&PathBuf
prefix
&PathBuf
&self
appdata
&PathBuf
desktop
&PathBuf
prefix
&PathBuf