mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 14:13:00 +08:00
Fix build assets update (#3901)
* fix: build assets update from config * Updated changelog
This commit is contained in:
parent
eccfd345b5
commit
c54fbdb075
@ -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)
|
- Consolidated dev config into `config.yml` by [leaanthony](https://github.com/leaanthony)
|
||||||
|
|
||||||
### Fixed
|
### 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 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)
|
- 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)
|
- [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)
|
||||||
|
@ -122,6 +122,19 @@ type UpdateConfig struct {
|
|||||||
FileAssociations []FileAssociation `yaml:"fileAssociations"`
|
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 {
|
func UpdateBuildAssets(options *UpdateBuildAssetsOptions) error {
|
||||||
DisableFooter = true
|
DisableFooter = true
|
||||||
|
|
||||||
@ -132,18 +145,29 @@ func UpdateBuildAssets(options *UpdateBuildAssetsOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var config UpdateConfig
|
var config UpdateConfig
|
||||||
|
|
||||||
if options.Config != "" {
|
if options.Config != "" {
|
||||||
|
var wailsConfig WailsConfig
|
||||||
bytes, err := os.ReadFile(options.Config)
|
bytes, err := os.ReadFile(options.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = yaml.Unmarshal(bytes, &config)
|
err = yaml.Unmarshal(bytes, &wailsConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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 directory doesn't exist, create it
|
||||||
if _, err := os.Stat(options.Dir); os.IsNotExist(err) {
|
if _, err := os.Stat(options.Dir); os.IsNotExist(err) {
|
||||||
err = os.MkdirAll(options.Dir, 0755)
|
err = os.MkdirAll(options.Dir, 0755)
|
||||||
@ -157,8 +181,6 @@ func UpdateBuildAssets(options *UpdateBuildAssetsOptions) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
config.UpdateBuildAssetsOptions = *options
|
|
||||||
|
|
||||||
err = gosod.New(tfs).Extract(options.Dir, config)
|
err = gosod.New(tfs).Extract(options.Dir, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user