fn copy_frameworks_to_bundle(bundle_directory: &Path, settings: &Settings) -> crate::Result<()> {
  let frameworks = settings.osx_frameworks();
  if frameworks.is_empty() {
    return Ok(());
  }
  let dest_dir = bundle_directory.join("Frameworks");
  fs::create_dir_all(&bundle_directory)
    .with_context(|| format!("Failed to create Frameworks directory at {:?}", dest_dir))?;
  for framework in frameworks.iter() {
    if framework.ends_with(".framework") {
      let src_path = PathBuf::from(framework);
      let src_name = src_path
        .file_name()
        .expect("Couldn't get framework filename");
      common::copy_dir(&src_path, &dest_dir.join(&src_name))?;
      continue;
    } else if framework.contains('/') {
      return Err(crate::Error::GenericError(format!(
        "Framework path should have .framework extension: {}",
        framework
      )));
    }
    if let Some(home_dir) = dirs_next::home_dir() {
      if copy_framework_from(&dest_dir, framework, &home_dir.join("Library/Frameworks/"))? {
        continue;
      }
    }
    if copy_framework_from(&dest_dir, framework, &PathBuf::from("/Library/Frameworks/"))?
      || copy_framework_from(
        &dest_dir,
        framework,
        &PathBuf::from("/Network/Library/Frameworks/"),
      )?
    {
      continue;
    }
    return Err(crate::Error::GenericError(format!(
      "Could not locate framework: {}",
      framework
    )));
  }
  Ok(())
}
// Copies the OSX bundle frameworks to the .app
Copies the OSX bundle frameworks to the .app
Copies the OSX bundle frameworks to the . app
fn copy_frameworks_to_bundle(bundle_directory: &Path, settings: &Settings) -> crate::Result<()> {
  let frameworks = settings.osx_frameworks();
  if frameworks.is_empty() {
    return Ok(());
  }
  let dest_dir = bundle_directory.join("Frameworks");
  fs::create_dir_all(&bundle_directory)
    .with_context(|| format!("Failed to create Frameworks directory at {:?}", dest_dir))?;
  for framework in frameworks.iter() {
    if framework.ends_with(".framework") {
      let src_path = PathBuf::from(framework);
      let src_name = src_path
        .file_name()
        .expect("Couldn't get framework filename");
      common::copy_dir(&src_path, &dest_dir.join(&src_name))?;
      continue;
    } else if framework.contains('/') {
      return Err(crate::Error::GenericError(format!(
        "Framework path should have .framework extension: {}",
        framework
      )));
    }
    if let Some(home_dir) = dirs_next::home_dir() {
      if copy_framework_from(&dest_dir, framework, &home_dir.join("Library/Frameworks/"))? {
        continue;
      }
    }
    if copy_framework_from(&dest_dir, framework, &PathBuf::from("/Library/Frameworks/"))?
      || copy_framework_from(
        &dest_dir,
        framework,
        &PathBuf::from("/Network/Library/Frameworks/"),
      )?
    {
      continue;
    }
    return Err(crate::Error::GenericError(format!(
      "Could not locate framework: {}",
      framework
    )));
  }
  Ok(())
}
fn copy_frameworks_to_bundle ( bundle_directory : & Path , settings : & Settings ) -> crate :: Result < ( ) > { let frameworks = settings . osx_frameworks ( ) ; if frameworks . is_empty ( ) { return Ok ( ( ) ) ; } let dest_dir = bundle_directory . join ( " " ) ; fs :: create_dir_all ( & bundle_directory ) . with_context ( | | format ! ( " " dest_dir ) ) ? ; for framework in frameworks . iter ( ) { if framework . ends_with ( " " ) { let src_path = PathBuf :: from ( framework ) ; let src_name = src_path . file_name ( ) . expect ( " " ) ; common :: copy_dir ( & src_path , & dest_dir . join ( & src_name ) ) ? ; continue ; } else if framework . contains ( '/' ) { return Err ( crate :: Error :: GenericError ( format ! ( " " framework ) ) ) ; } if let Some ( home_dir ) = dirs_next :: home_dir ( ) { if copy_framework_from ( & dest_dir , framework , & home_dir . join ( " " ) ) ? { continue ; } } if copy_framework_from ( & dest_dir , framework , & PathBuf :: from ( " " ) ) ? || copy_framework_from ( & dest_dir , framework , & PathBuf :: from ( " " ) , ) ? { continue ; } return Err ( crate :: Error :: GenericError ( format ! ( " " framework ) ) ) ; } Ok ( ( ) ) }
Copies the OSX bundle frameworks to the .app
Copies the OSX bundle frameworks to the . app
bundle_directory
&Path
settings
&Settings
bundle_directory
&Path
settings
&Settings