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

Code before:
  let mut files_ids = Vec::new();
  for (_, dir) in resources {
    let (wix_string, ids) = dir.get_wix_data()?;
    resources_wix_string.push_str(wix_string.as_str());
    for id in ids {
      files_ids.push(id);
    }
  }

  data.insert("resources", to_json(resources_wix_string));
  data.insert("resource_file_ids", to_json(files_ids));

  let merge_modules = get_merge_modules(settings)?;
  data.insert("merge_modules", to_json(merge_modules));

  // Note: `main_binary_name` is not used in our template but we keep it as it is potentially useful for custom temples
  let main_binary_name = settings.main_binary_name()?;
  data.insert("main_binary_name", to_json(main_binary_name));

  let main_binary = settings.main_binary()?;
  let main_binary_path = settings.binary_path(main_binary);
  data.insert("main_binary_path", to_json(main_binary_path));

  // copy icon from `settings.windows().icon_path` folder to resource folder near msi
  #[allow(deprecated)]
  let icon_path = if settings.windows().icon_path.as_os_str().is_empty() {
    settings.windows().icon_path.clone()
  } else {
    settings
      .icon_files()
      .flatten()
      .find(|i| i.ends_with(".ico"))
      .context("Couldn't find a .ico file")?
  };
  let icon_path = copy_icon(settings, "icon.ico", &icon_path)?;

  data.insert("icon_path", to_json(icon_path));

  let mut fragment_paths = Vec::new();
  let mut handlebars = Handlebars::new();
  handlebars.register_escape_fn(handlebars::no_escape);
  let mut custom_template_path = None;
  let mut enable_elevated_update_task = false;

  if let Some(wix) = &settings.windows().wix {
    data.insert("component_group_refs", to_json(&wix.component_group_refs));
    data.insert("component_refs", to_json(&wix.component_refs));
    data.insert("feature_group_refs", to_json(&wix.feature_group_refs));
    data.insert("feature_refs", to_json(&wix.feature_refs));
    data.insert("merge_refs", to_json(&wix.merge_refs));
    fragment_paths.clone_from(&wix.fragment_paths);

Review comment (suggestion):
```suggestion
  let icon_path = if !settings.windows().icon_path.as_os_str().is_empty() {
```

Code after:
  let mut files_ids = Vec::new();
  for (_, dir) in resources {
    let (wix_string, ids) = dir.get_wix_data()?;
    resources_wix_string.push_str(wix_string.as_str());
    for id in ids {
      files_ids.push(id);
    }
  }

  data.insert("resources", to_json(resources_wix_string));
  data.insert("resource_file_ids", to_json(files_ids));

  let merge_modules = get_merge_modules(settings)?;
  data.insert("merge_modules", to_json(merge_modules));

  // Note: `main_binary_name` is not used in our template but we keep it as it is potentially useful for custom temples
  let main_binary_name = settings.main_binary_name()?;
  data.insert("main_binary_name", to_json(main_binary_name));

  let main_binary = settings.main_binary()?;
  let main_binary_path = settings.binary_path(main_binary);
  data.insert("main_binary_path", to_json(main_binary_path));

  // copy icon from `settings.windows().icon_path` folder to resource folder near msi
  #[allow(deprecated)]
  let icon_path = if !settings.windows().icon_path.as_os_str().is_empty() {
    settings.windows().icon_path.clone()
  } else {
    settings
      .icon_files()
      .flatten()
      .find(|i| i.ends_with(".ico"))
      .context("Couldn't find a .ico icon")?
  };
  let icon_path = copy_icon(settings, "icon.ico", &icon_path)?;

  data.insert("icon_path", to_json(icon_path));

  let mut fragment_paths = Vec::new();
  let mut handlebars = Handlebars::new();
  handlebars.register_escape_fn(handlebars::no_escape);
  let mut custom_template_path = None;
  let mut enable_elevated_update_task = false;

  if let Some(wix) = &settings.windows().wix {
    data.insert("component_group_refs", to_json(&wix.component_group_refs));
    data.insert("component_refs", to_json(&wix.component_refs));
    data.insert("feature_group_refs", to_json(&wix.feature_group_refs));
    data.insert("feature_refs", to_json(&wix.feature_refs));
    data.insert("merge_refs", to_json(&wix.merge_refs));
    fragment_paths.clone_from(&wix.fragment_paths);