mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
fix: don't return error when SaveFileDialog is cancelled by the user
This commit is contained in:
parent
d1838f42bf
commit
105c10aee7
4 changed files with 8 additions and 6 deletions
|
|
@ -4,4 +4,6 @@ import "errors"
|
|||
|
||||
var (
|
||||
ErrCancelled = errors.New("cancelled by user")
|
||||
ErrInvalidGUID = errors.New("guid cannot be nil")
|
||||
ErrEmptyFilters = errors.New("must specify at least one filter")
|
||||
)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ func (vtbl *iShellItemArrayVtbl) getItemAt(objPtr unsafe.Pointer, index uintptr)
|
|||
return "", err
|
||||
}
|
||||
if shellItem == nil {
|
||||
return "", fmt.Errorf("shellItem is nil")
|
||||
return "", ErrCancelled
|
||||
}
|
||||
defer shellItem.vtbl.release(unsafe.Pointer(shellItem))
|
||||
return shellItem.vtbl.getDisplayName(unsafe.Pointer(shellItem))
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ func (vtbl *iModalWindowVtbl) show(objPtr unsafe.Pointer, hwnd uintptr) error {
|
|||
func (vtbl *iFileDialogVtbl) setFileTypes(objPtr unsafe.Pointer, filters []FileFilter) error {
|
||||
cFileTypes := len(filters)
|
||||
if cFileTypes < 0 {
|
||||
return fmt.Errorf("must specify at least one filter")
|
||||
return ErrEmptyFilters
|
||||
}
|
||||
comDlgFilterSpecs := make([]comDlgFilterSpec, cFileTypes)
|
||||
for i := 0; i < cFileTypes; i++ {
|
||||
|
|
@ -168,7 +168,7 @@ func (vtbl *iFileDialogVtbl) getResultString(objPtr unsafe.Pointer) (string, err
|
|||
return "", err
|
||||
}
|
||||
if shellItem == nil {
|
||||
return "", fmt.Errorf("shellItem is nil")
|
||||
return "", ErrCancelled
|
||||
}
|
||||
defer shellItem.vtbl.release(unsafe.Pointer(shellItem))
|
||||
return shellItem.vtbl.getDisplayName(unsafe.Pointer(shellItem))
|
||||
|
|
@ -177,7 +177,7 @@ func (vtbl *iFileDialogVtbl) getResultString(objPtr unsafe.Pointer) (string, err
|
|||
func (vtbl *iFileDialogVtbl) setClientGuid(objPtr unsafe.Pointer, guid *ole.GUID) error {
|
||||
// Ensure the GUID is not nil
|
||||
if guid == nil {
|
||||
return fmt.Errorf("guid cannot be nil")
|
||||
return ErrInvalidGUID
|
||||
}
|
||||
|
||||
// Call the SetClientGuid method
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
- Fixed Window size issues on Wayland [PR](https://github.com/wailsapp/wails/pull/4047) by [@lyimmi](https://github.com/lyimmi)
|
||||
- Fixed SaveFileDialog cancellation result [PR](https://github.com/wailsapp/wails/pull/4253) by [@FrancescoLuzzi](https://github.com/FrancescoLuzzi)
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
@ -88,10 +89,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fixed CGO memory issue on Darwin by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3590)
|
||||
- Fixed an error that occurred when an author name contains a string that is not suitable for JSON. Fixed by @taiseiotsuka in [PR](https://github.com/wailsapp/wails/pull/3638)
|
||||
- Fixed MacOS build to use `outputfilename` from wails.json. [#3200](https://github.com/wailsapp/wails/issues/3200)
|
||||
- Fixed file drop events on windows. Fixed in [PR](https://github.com/wailsapp/wails/pull/3595) by @FrancescoLuzzi
|
||||
- Fixed doctor command not finding pkg-config on Solus. [PR #3670](https://github.com/wailsapp/wails/pull/3670) by [@ianmjones](https://github.com/ianmjones)
|
||||
- Fixed binding for struct fields that were exported but had no json tags. [PR #3678](https://github.com/wailsapp/wails/pull/3678)
|
||||
- Fixed file drop events on Windows in [PR](https://github.com/wailsapp/wails/pull/3595) by @FrancescoLuzzi
|
||||
- Fixed file drop events on Windows in [PR](https://github.com/wailsapp/wails/pull/3595) by [@FrancescoLuzzi](https://github.com/FrancescoLuzzi)
|
||||
- Modified `ZoomFactor` and `IsZoomControlEnabled` options to be Windows-only options in PR[#3644](https://github.com/wailsapp/wails/pull/3644) by @levinit
|
||||
- Added nil check for Drag-n-Drop on Windows. Fixed by in [PR](https://github.com/wailsapp/wails/pull/3597) by @leaanthony based on the suggestion by @Alpa-1 in [#3596](https://github.com/wailsapp/wails/issues/3596).
|
||||
- Fixed typos in various .mdx files. [PR #3628](https://github.com/wailsapp/wails/pull/3628) by [@deining](https://github.com/deining)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue