Feature Request: Support file association properties in forge.config.js
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 641
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 30
Description
### Pre-flight checklist
- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
### Problem description
Other electron build systems allow the developer to specify custom file extensions for their built apps. For instance, if I wrote an app that was a editor for "Foo" files, I would want to be able to launch a file with the extension `.foo` in the system that would then open the application with that file. As a developer I could then handle the file's contents via the `app` `open-file` event handler. In addition, `.foo` files should have their own specific icon.
Currently providing this information via platform-specific configuration files (such as for Windows, OSX, and Linux) is cumbersome and the method for doing so is not always well documented, making cross-platform applications that much more difficult to create.
### Proposed solution
I would suggest a set of forge configuration properties such as:
```
module.exports = {
packagerConfig: {
"fileAssociations": [
{
"ext": "foo",
"name": "Foo File",
"icon": "assets/icon/foofile.icns"
}
],
}
}
```
...where one or more file associations can be specified.
- `ext` is the name of the file extension to associate with one's Electron application
- `name` is the label that the platform presents to users in the user interface
- `icon` is the path to the icon for this type of file
Refer to the `fileAssociations` section of [https://www.electron.build/configuration/configuration.html](https://www.electron.build/configuration/configuration.html) for more information. Note that their set of configuration properties allows this feature to be used in OSX, Windows, and Linux applications.
### Alternatives considered
Currently in order to implement this in OSX, a separate `Info.plist` file must be provided that contains the correct metadata to enable one or more file associations to work. In Windows a separate file containing file association properties must be generated as well. This is cumbersome for developers, who must currently deal with many sets of documentation to implement this feature on multiple platforms.
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.