You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added support to defining the metadata for custom types declared in `tauri.conf.json > bundle > fileAssociations > exportedType` via the `UTExportedTypeDeclarations` Info.plist property.
Copy file name to clipboardExpand all lines: crates/tauri-cli/config.schema.json
+46-1Lines changed: 46 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2159,7 +2159,7 @@
2159
2159
]
2160
2160
},
2161
2161
"fileAssociations": {
2162
-
"description": "File associations to application.",
2162
+
"description": "File types to associate with the application.",
2163
2163
"type": [
2164
2164
"array",
2165
2165
"null"
@@ -2433,6 +2433,16 @@
2433
2433
"$ref": "#/definitions/AssociationExt"
2434
2434
}
2435
2435
},
2436
+
"contentTypes": {
2437
+
"description": "Declare support to a file with the given content type. Maps to `LSItemContentTypes` on macOS.\n\n This allows supporting any file format declared by another application that conforms to this type.\n Declaration of new types can be done with [`Self::exported_type`] and linking to certain content types are done via [`ExportedFileAssociation::conforms_to`].",
2438
+
"type": [
2439
+
"array",
2440
+
"null"
2441
+
],
2442
+
"items": {
2443
+
"type": "string"
2444
+
}
2445
+
},
2436
2446
"name": {
2437
2447
"description": "The name. Maps to `CFBundleTypeName` on macOS. Default to `ext[0]`",
2438
2448
"type": [
@@ -2471,6 +2481,17 @@
2471
2481
"$ref": "#/definitions/HandlerRank"
2472
2482
}
2473
2483
]
2484
+
},
2485
+
"exportedType": {
2486
+
"description": "The exported type definition. Maps to a `UTExportedTypeDeclarations` entry on macOS.\n\n You should define this if the associated file is a custom file type defined by your application.",
2487
+
"anyOf": [
2488
+
{
2489
+
"$ref": "#/definitions/ExportedFileAssociation"
2490
+
},
2491
+
{
2492
+
"type": "null"
2493
+
}
2494
+
]
2474
2495
}
2475
2496
},
2476
2497
"additionalProperties": false
@@ -2552,6 +2573,30 @@
2552
2573
}
2553
2574
]
2554
2575
},
2576
+
"ExportedFileAssociation": {
2577
+
"description": "The exported type definition. Maps to a `UTExportedTypeDeclarations` entry on macOS.",
2578
+
"type": "object",
2579
+
"required": [
2580
+
"identifier"
2581
+
],
2582
+
"properties": {
2583
+
"identifier": {
2584
+
"description": "The unique identifier for the exported type. Maps to `UTTypeIdentifier`.",
2585
+
"type": "string"
2586
+
},
2587
+
"conformsTo": {
2588
+
"description": "The types that this type conforms to. Maps to `UTTypeConformsTo`.\n\n Examples are `public.data`, `public.image`, `public.json` and `public.database`.",
2589
+
"type": [
2590
+
"array",
2591
+
"null"
2592
+
],
2593
+
"items": {
2594
+
"type": "string"
2595
+
}
2596
+
}
2597
+
},
2598
+
"additionalProperties": false
2599
+
},
2555
2600
"WindowsConfig": {
2556
2601
"description": "Windows bundler configuration.\n\n See more: <https://v2.tauri.app/reference/config/#windowsconfig>",
Copy file name to clipboardExpand all lines: crates/tauri-schema-generator/schemas/config.schema.json
+46-1Lines changed: 46 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2159,7 +2159,7 @@
2159
2159
]
2160
2160
},
2161
2161
"fileAssociations": {
2162
-
"description": "File associations to application.",
2162
+
"description": "File types to associate with the application.",
2163
2163
"type": [
2164
2164
"array",
2165
2165
"null"
@@ -2433,6 +2433,16 @@
2433
2433
"$ref": "#/definitions/AssociationExt"
2434
2434
}
2435
2435
},
2436
+
"contentTypes": {
2437
+
"description": "Declare support to a file with the given content type. Maps to `LSItemContentTypes` on macOS.\n\n This allows supporting any file format declared by another application that conforms to this type.\n Declaration of new types can be done with [`Self::exported_type`] and linking to certain content types are done via [`ExportedFileAssociation::conforms_to`].",
2438
+
"type": [
2439
+
"array",
2440
+
"null"
2441
+
],
2442
+
"items": {
2443
+
"type": "string"
2444
+
}
2445
+
},
2436
2446
"name": {
2437
2447
"description": "The name. Maps to `CFBundleTypeName` on macOS. Default to `ext[0]`",
2438
2448
"type": [
@@ -2471,6 +2481,17 @@
2471
2481
"$ref": "#/definitions/HandlerRank"
2472
2482
}
2473
2483
]
2484
+
},
2485
+
"exportedType": {
2486
+
"description": "The exported type definition. Maps to a `UTExportedTypeDeclarations` entry on macOS.\n\n You should define this if the associated file is a custom file type defined by your application.",
2487
+
"anyOf": [
2488
+
{
2489
+
"$ref": "#/definitions/ExportedFileAssociation"
2490
+
},
2491
+
{
2492
+
"type": "null"
2493
+
}
2494
+
]
2474
2495
}
2475
2496
},
2476
2497
"additionalProperties": false
@@ -2552,6 +2573,30 @@
2552
2573
}
2553
2574
]
2554
2575
},
2576
+
"ExportedFileAssociation": {
2577
+
"description": "The exported type definition. Maps to a `UTExportedTypeDeclarations` entry on macOS.",
2578
+
"type": "object",
2579
+
"required": [
2580
+
"identifier"
2581
+
],
2582
+
"properties": {
2583
+
"identifier": {
2584
+
"description": "The unique identifier for the exported type. Maps to `UTTypeIdentifier`.",
2585
+
"type": "string"
2586
+
},
2587
+
"conformsTo": {
2588
+
"description": "The types that this type conforms to. Maps to `UTTypeConformsTo`.\n\n Examples are `public.data`, `public.image`, `public.json` and `public.database`.",
2589
+
"type": [
2590
+
"array",
2591
+
"null"
2592
+
],
2593
+
"items": {
2594
+
"type": "string"
2595
+
}
2596
+
}
2597
+
},
2598
+
"additionalProperties": false
2599
+
},
2555
2600
"WindowsConfig": {
2556
2601
"description": "Windows bundler configuration.\n\n See more: <https://v2.tauri.app/reference/config/#windowsconfig>",
Copy file name to clipboardExpand all lines: crates/tauri-utils/src/config.rs
+25-1Lines changed: 25 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1177,6 +1177,12 @@ impl<'d> serde::Deserialize<'d> for AssociationExt {
1177
1177
pubstructFileAssociation{
1178
1178
/// File extensions to associate with this app. e.g. 'png'
1179
1179
pubext:Vec<AssociationExt>,
1180
+
/// Declare support to a file with the given content type. Maps to `LSItemContentTypes` on macOS.
1181
+
///
1182
+
/// This allows supporting any file format declared by another application that conforms to this type.
1183
+
/// Declaration of new types can be done with [`Self::exported_type`] and linking to certain content types are done via [`ExportedFileAssociation::conforms_to`].
1184
+
#[serde(alias = "content-types")]
1185
+
pubcontent_types:Option<Vec<String>>,
1180
1186
/// The name. Maps to `CFBundleTypeName` on macOS. Default to `ext[0]`
1181
1187
pubname:Option<String>,
1182
1188
/// The association description. Windows-only. It is displayed on the `Type` column on Windows Explorer.
Copy file name to clipboardExpand all lines: examples/file-associations/README.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,3 +11,9 @@ This feature is commonly used for functionality such as previewing or editing fi
11
11
```
12
12
cargo build --features tauri/protocol-asset
13
13
```
14
+
15
+
## Associations
16
+
17
+
This example creates associations with PNG, JPG, JPEG and GIF files.
18
+
19
+
Additionally, it defines two new extensions - `taurid` (derives from a raw data file) and `taurijson` (derives from JSON). They have special treatment on macOS (see `exportedType` in `src-tauri/tauri.conf.json`).
0 commit comments