Repository: tauri-apps/tauri
File: crates/tauri-cli/src/build.rs (Rust)

Code before:
  }

  if config_
    .identifier
    .chars()
    .any(|ch| !(ch.is_alphanumeric() || ch == '-' || ch == '.'))
  {
    log::error!(
      "The bundle identifier \"{}\" set in `{} identifier`. The bundle identifier string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-), and periods (.).",
      config_.identifier,
      bundle_identifier_source
    );
    std::process::exit(1);
  }

  if config_.identifier.ends_with(".app") {
    if cfg!(target_os = "macos") {
      log::error!(
        "The bundle identifier \"{}\" set in `{} identifier` must not end with `.app` on macOS because it conflicts with the application bundle extension.",
        config_.identifier,
        bundle_identifier_source
      );
      std::process::exit(1);
    } else {
      log::warn!(
        "The bundle identifier \"{}\" set in `{} identifier` ends with `.app`. This is not recommended as it will cause issues on macOS.",
        config_.identifier,
        bundle_identifier_source
      );
    }
  }

  if let Some(before_build) = config_.build.before_build_command.clone() {
    helpers::run_hook("beforeBuildCommand", before_build, interface, options.debug)?;
  }

  if let Some(FrontendDist::Directory(web_asset_path)) = &config_.build.frontend_dist {
    if !web_asset_path.exists() {
      let absolute_path = web_asset_path
        .parent()
        .and_then(|p| p.canonicalize().ok())
        .map(|p| p.join(web_asset_path.file_name().unwrap()))
        .unwrap_or_else(|| std::env::current_dir().unwrap().join(web_asset_path));
      return Err(anyhow::anyhow!(
          "Unable to find your web assets, did you forget to build your web app? Your frontendDist is set to \"{}\" (which is `{}`).",
          web_asset_path.display(), absolute_path.display(),
        ));
    }
    if web_asset_path.canonicalize()?.file_name() == Some(std::ffi::OsStr::new("src-tauri")) {
      return Err(anyhow::anyhow!(
          "The configured frontendDist is the `src-tauri` folder. Please isolate your web assets on a separate folder and update `tauri.conf.json > build > frontendDist`.",

Review comment (suggestion):
Maybe we could explain the reason on other platforms as well? (`because it conflicts with the application bundle extension`)

Code after:
  }

  if config_
    .identifier
    .chars()
    .any(|ch| !(ch.is_alphanumeric() || ch == '-' || ch == '.'))
  {
    log::error!(
      "The bundle identifier \"{}\" set in `{} identifier`. The bundle identifier string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-), and periods (.).",
      config_.identifier,
      bundle_identifier_source
    );
    std::process::exit(1);
  }

  if config_.identifier.ends_with(".app") {
    if cfg!(target_os = "macos") {
      log::error!(
        "The bundle identifier \"{}\" set in `{} identifier` must not end with `.app` on macOS because it conflicts with the application bundle extension.",
        config_.identifier,
        bundle_identifier_source
      );
      std::process::exit(1);
    } else {
      log::warn!(
        "The bundle identifier \"{}\" set in `{} identifier` ends with `.app`. This is not recommended because it conflicts with the application bundle extension on macOS.",
        config_.identifier,
        bundle_identifier_source
      );
    }
  }

  if let Some(before_build) = config_.build.before_build_command.clone() {
    helpers::run_hook("beforeBuildCommand", before_build, interface, options.debug)?;
  }

  if let Some(FrontendDist::Directory(web_asset_path)) = &config_.build.frontend_dist {
    if !web_asset_path.exists() {
      let absolute_path = web_asset_path
        .parent()
        .and_then(|p| p.canonicalize().ok())
        .map(|p| p.join(web_asset_path.file_name().unwrap()))
        .unwrap_or_else(|| std::env::current_dir().unwrap().join(web_asset_path));
      return Err(anyhow::anyhow!(
          "Unable to find your web assets, did you forget to build your web app? Your frontendDist is set to \"{}\" (which is `{}`).",
          web_asset_path.display(), absolute_path.display(),
        ));
    }
    if web_asset_path.canonicalize()?.file_name() == Some(std::ffi::OsStr::new("src-tauri")) {
      return Err(anyhow::anyhow!(
          "The configured frontendDist is the `src-tauri` folder. Please isolate your web assets on a separate folder and update `tauri.conf.json > build > frontendDist`.",