Skip to content

Commit 78bfc6c

Browse files
committed
simplified the bundle writing process
to handle both it and dmg
1 parent af3c60d commit 78bfc6c

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/bundle/osx_bundle.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ use std::io::{self, BufWriter};
3131
use std::path::{Path, PathBuf};
3232

3333
pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
34+
let base_dir = settings.project_out_directory().join("bundle/osx");
35+
let path = bundle_project_at(settings, &base_dir)?;
36+
Ok(vec![path])
37+
}
38+
39+
pub fn bundle_project_at(settings: &Settings, output_dir: &Path) -> crate::Result<PathBuf> {
3440
let app_bundle_name = format!("{}.app", settings.bundle_name());
3541
common::print_bundling(&app_bundle_name)?;
36-
let app_bundle_path = settings
37-
.project_out_directory()
38-
.join("bundle/osx")
39-
.join(&app_bundle_name);
42+
let app_bundle_path = output_dir.join(&app_bundle_name);
4043
if app_bundle_path.exists() {
4144
fs::remove_dir_all(&app_bundle_path)
4245
.with_context(|| format!("Failed to remove old {app_bundle_name}"))?;
@@ -70,11 +73,14 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
7073
copy_binary_to_bundle(&bundle_directory, settings)
7174
.with_context(|| format!("Failed to copy binary from {:?}", settings.binary_path()))?;
7275

76+
write_localizations(&resources_dir, settings)
77+
.with_context(|| "Failed to write localisation files")?;
78+
7379
if copied > 0 {
7480
add_rpath(&bundle_directory, settings)?;
7581
}
7682

77-
Ok(vec![app_bundle_path])
83+
Ok(app_bundle_path)
7884
}
7985

8086
#[allow(dead_code)]

0 commit comments

Comments
 (0)