Repository: tauri-apps/tauri
File: crates/tauri-bundler/src/bundle/settings.rs (Rust)

Code before:
      .binaries
      .iter()
      .find(|bin| bin.main)
      .context("failed to find main binary, make sure you have a `package > default-run` in the Cargo.toml file")
      .map_err(Into::into)
  }

  /// Returns the file name of the binary being bundled.
  pub fn main_binary_name(&self) -> crate::Result<&str> {
    self
      .binaries
      .iter()
      .find(|bin| bin.main)
      .context("failed to find main binary, make sure you have a `package > default-run` in the Cargo.toml file")
      .map(|b| b.name())
      .map_err(Into::into)
  }

  /// Returns the path to the specified binary.
  pub fn binary_path(&self, binary: &BundleBinary) -> PathBuf {
    let target_os = self
      .target()
      .split('-')
      .nth(2)
      .unwrap_or(std::env::consts::OS)
      .replace("darwin", "macos");

    let path = self.project_out_directory.join(binary.name());

    if target_os == "windows" {
      path.with_extension("exe")
    } else {
      path
    }
  }

  /// Returns the list of binaries to bundle.
  pub fn binaries(&self) -> &Vec<BundleBinary> {
    &self.binaries
  }

  /// If a list of package types was specified by the command-line, returns
  /// that list filtered by the current target OS available targets.
  ///
  /// If a target triple was specified by the
  /// command-line, returns the native package type(s) for that target.
  ///
  /// Otherwise returns the native package type(s) for the host platform.
  ///
  /// Fails if the host/target's native package type is not supported.
  pub fn package_types(&self) -> crate::Result<Vec<PackageType>> {

Review comment (suggestion):
```suggestion
      .unwrap_or(std::env::consts::OS);
```

Code after:
      .binaries
      .iter()
      .find(|bin| bin.main)
      .context("failed to find main binary, make sure you have a `package > default-run` in the Cargo.toml file")
      .map_err(Into::into)
  }

  /// Returns the file name of the binary being bundled.
  pub fn main_binary_name(&self) -> crate::Result<&str> {
    self
      .binaries
      .iter()
      .find(|bin| bin.main)
      .context("failed to find main binary, make sure you have a `package > default-run` in the Cargo.toml file")
      .map(|b| b.name())
      .map_err(Into::into)
  }

  /// Returns the path to the specified binary.
  pub fn binary_path(&self, binary: &BundleBinary) -> PathBuf {
    let target_os = self
      .target()
      .split('-')
      .nth(2)
      .unwrap_or(std::env::consts::OS);

    let path = self.project_out_directory.join(binary.name());

    if target_os == "windows" {
      path.with_extension("exe")
    } else {
      path
    }
  }

  /// Returns the list of binaries to bundle.
  pub fn binaries(&self) -> &Vec<BundleBinary> {
    &self.binaries
  }

  /// If a list of package types was specified by the command-line, returns
  /// that list filtered by the current target OS available targets.
  ///
  /// If a target triple was specified by the
  /// command-line, returns the native package type(s) for that target.
  ///
  /// Otherwise returns the native package type(s) for the host platform.
  ///
  /// Fails if the host/target's native package type is not supported.
  pub fn package_types(&self) -> crate::Result<Vec<PackageType>> {
    let target_os = self