Skip to content

Commit

Permalink
feat: Unable to add files to dmg interface
Browse files Browse the repository at this point in the history
[11892](#11892)
  • Loading branch information
huifer committed Dec 19, 2024
1 parent 8f24914 commit 2a795e9
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 32 deletions.
5 changes: 2 additions & 3 deletions crates/tauri-bundler/src/bundle/macos/dmg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,12 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<

for item in &dmg_settings.files {
let _arg = format!("{} {:?} {} {}", item.name, item.path, item.x, item.y);
bundle_dmg_cmd.arg("--add-file" );
bundle_dmg_cmd.arg("--add-file");
bundle_dmg_cmd.arg(&item.name);

if item.path.is_absolute() {
bundle_dmg_cmd.arg(&item.path);
}
else {
} else {
bundle_dmg_cmd.arg(env::current_dir()?.join(&item.path));
}

Expand Down
2 changes: 1 addition & 1 deletion crates/tauri-bundler/src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ pub struct DmgSettings {
/// Position of application folder on window.
pub application_folder_position: Position,
/// Need to add files to the dmg collection
pub files: Vec<DmgFile>
pub files: Vec<DmgFile>,
}

/// The macOS bundle settings.
Expand Down
5 changes: 5 additions & 0 deletions crates/tauri-cli/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3339,6 +3339,7 @@
]
},
"files": {
"description": "Need to add files to the dmg collection",
"default": [],
"type": "array",
"items": {
Expand Down Expand Up @@ -3404,17 +3405,21 @@
],
"properties": {
"path": {
"description": "The path to the file.",
"type": "string"
},
"name": {
"description": "The name of the file.",
"type": "string"
},
"x": {
"description": "The x-coordinate associated with the file.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"y": {
"description": "The y-coordinate associated with the file.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
Expand Down
5 changes: 5 additions & 0 deletions crates/tauri-schema-generator/schemas/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3339,6 +3339,7 @@
]
},
"files": {
"description": "Need to add files to the dmg collection",
"default": [],
"type": "array",
"items": {
Expand Down Expand Up @@ -3404,17 +3405,21 @@
],
"properties": {
"path": {
"description": "The path to the file.",
"type": "string"
},
"name": {
"description": "The name of the file.",
"type": "string"
},
"x": {
"description": "The x-coordinate associated with the file.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"y": {
"description": "The y-coordinate associated with the file.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
Expand Down
40 changes: 13 additions & 27 deletions crates/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,40 +547,26 @@ pub struct DmgConfig {
)]
pub application_folder_position: Position,
/// Need to add files to the dmg collection
#[serde(
default = "files_default",
alias = "files"
)]
#[serde(default = "files_default", alias = "files")]
pub files: Vec<DmgFile>,

}


#[derive(Default, Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct DmgFile {
#[serde(
alias = "path"
)]
/// The path to the file.
pub path: PathBuf,
#[serde(
alias = "name"
)]
/// The name of the file.
pub name: String,
#[serde(
alias = "x"
)]
/// The x-coordinate associated with the file.
pub x: u32,
#[serde(
alias = "y"
)]
/// The y-coordinate associated with the file.
pub y: u32,

#[serde(alias = "path")]
/// The path to the file.
pub path: PathBuf,
#[serde(alias = "name")]
/// The name of the file.
pub name: String,
#[serde(alias = "x")]
/// The x-coordinate associated with the file.
pub x: u32,
#[serde(alias = "y")]
/// The y-coordinate associated with the file.
pub y: u32,
}

impl Default for DmgConfig {
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/scripts/bundle.global.js

Large diffs are not rendered by default.

0 comments on commit 2a795e9

Please sign in to comment.