5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 20:10:00 +08:00

Fix build assets update (#3901)

* fix: build assets update from config

* Updated changelog
This commit is contained in:
Anshuman 2024-11-22 15:12:19 +05:30 committed by GitHub
parent eccfd345b5
commit c54fbdb075
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 4 deletions

View File

@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Consolidated dev config into `config.yml` by [leaanthony](https://github.com/leaanthony)
### Fixed
- Fixed build assets update by @ansxuman in [#3900](https://github.com/wailsapp/wails/pull/3900)
- Fixed Linux systray `OnClick` and `OnRightClick` implementation by @atterpac in [#3886](https://github.com/wailsapp/wails/pull/3886)
- Fixed `AlwaysOnTop` not working on Mac by [leaanthony](https://github.com/leaanthony) in [#3841](https://github.com/wailsapp/wails/pull/3841)
- [darwin] Fixed `application.NewEditMenu` including a duplicate `PasteAndMatchStyle` role in the edit menu on Darwin by [johnmccabe](https://github.com/johnmccabe) in [#3839](https://github.com/wailsapp/wails/pull/3839)

View File

@ -122,6 +122,19 @@ type UpdateConfig struct {
FileAssociations []FileAssociation `yaml:"fileAssociations"`
}
type WailsConfig struct {
Info struct {
CompanyName string `yaml:"companyName"`
ProductName string `yaml:"productName"`
ProductIdentifier string `yaml:"productIdentifier"`
Description string `yaml:"description"`
Copyright string `yaml:"copyright"`
Comments string `yaml:"comments"`
Version string `yaml:"version"`
} `yaml:"info"`
FileAssociations []FileAssociation `yaml:"fileAssociations"`
}
func UpdateBuildAssets(options *UpdateBuildAssetsOptions) error {
DisableFooter = true
@ -132,18 +145,29 @@ func UpdateBuildAssets(options *UpdateBuildAssetsOptions) error {
}
var config UpdateConfig
if options.Config != "" {
var wailsConfig WailsConfig
bytes, err := os.ReadFile(options.Config)
if err != nil {
return err
}
err = yaml.Unmarshal(bytes, &config)
err = yaml.Unmarshal(bytes, &wailsConfig)
if err != nil {
return err
}
options.ProductCompany = wailsConfig.Info.CompanyName
options.ProductName = wailsConfig.Info.ProductName
options.ProductIdentifier = wailsConfig.Info.ProductIdentifier
options.ProductDescription = wailsConfig.Info.Description
options.ProductCopyright = wailsConfig.Info.Copyright
options.ProductComments = wailsConfig.Info.Comments
options.ProductVersion = wailsConfig.Info.Version
config.FileAssociations = wailsConfig.FileAssociations
}
config.UpdateBuildAssetsOptions = *options
// If directory doesn't exist, create it
if _, err := os.Stat(options.Dir); os.IsNotExist(err) {
err = os.MkdirAll(options.Dir, 0755)
@ -157,8 +181,6 @@ func UpdateBuildAssets(options *UpdateBuildAssetsOptions) error {
return err
}
config.UpdateBuildAssetsOptions = *options
err = gosod.New(tfs).Extract(options.Dir, config)
if err != nil {
return err