issues
search
wailsapp
/
wails
Create beautiful applications using Go
https://wails.io
MIT License
25.26k
stars
1.22k
forks
source link
Check valid Windows paths for ``runtime.OpenDirectoryDialog``
#1381
Closed
leaanthony
closed
2 years ago
leaanthony
commented
2 years ago
Discussed in
https://github.com/wailsapp/wails/discussions/1371
Originally posted by **KiddoV** May 3, 2022
What am I doing wrong here? In GO: ```go func (a *App) OpenDirectoryDialog(dialogOptions interface{}) (string, error) { directoryPath, err := runtime.OpenDirectoryDialog(a.ctx, runtime.OpenDialogOptions{ DefaultDirectory: fmt.Sprintf("%v", dialogOptions.(map[string]interface{})["defaultDirectory"]), Title: fmt.Sprintf("%v", dialogOptions.(map[string]interface{})["title"]), }) if err != nil { return "", fmt.Errorf("failed opening dialog - %s", err.Error()) } return directoryPath, nil } ``` In JS: ```js window.go.main.App.OpenDirectoryDialog({ defaultDirectory: "C:/", title: "Please select a folder to save Top and Bot CAD files..." }).then(path => { //returned path }).catch(err => { //Got ERR }); ``` I go PANIC when calling ``window.go.main.App.OpenDirectoryDialog`` in JS!! ```cmd panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x10d9c58] goroutine 38 [running]: github.com/leaanthony/go-common-file-dialog/cfd.(*iFileDialogVtbl).setFolder(0x7fffb9490b30, 0x1f149581900, {0xc0002a05e0, 0x10a8801}) C:/Users/vho/go/pkg/mod/github.com/leaanthony/go-common-file-dialog@v1.0.3/cfd/vtblCommonFunc.go:137 +0x78 github.com/leaanthony/go-common-file-dialog/cfd.(*iFileOpenDialog).SetFolder(0x1f149581900, {0xc0002a05e0, 0x5}) C:/Users/vho/go/pkg/mod/github.com/leaanthony/go-common-file-dialog@v1.0.3/cfd/iFileOpenDialog.go:100 +0x2f github.com/leaanthony/go-common-file-dialog/cfd.(*DialogConfig).apply(0xc0002bf3e8, {0x2191708, 0x1f149581900}) C:/Users/vho/go/pkg/mod/github.com/leaanthony/go-common-file-dialog@v1.0.3/cfd/DialogConfig.go:70 +0xbe github.com/leaanthony/go-common-file-dialog/cfd.NewSelectFolderDialog({{0xc00001e600, 0x37}, {0x12c8fe3, 0xa}, {0x0, 0x0}, {0xc0002a05e0, 0x3}, {0x0, 0x0, ...}, ...}) C:/Users/vho/go/pkg/mod/github.com/leaanthony/go-common-file-dialog@v1.0.3/cfd/CommonFileDialog_windows.go:54 +0x65 github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.(*Frontend).OpenDirectoryDialog(0xc000068000, {{0xc0002a05e0, 0x3}, {0x0, 0x0}, {0xc00001e600, 0x37}, {0x0, 0x0, 0x0}, ...}) C:/Users/vho/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.35/internal/frontend/desktop/windows/dialog.go:20 +0x11f github.com/wailsapp/wails/v2/pkg/runtime.OpenDirectoryDialog({0x2188920, 0xc00002e9c0}, {{0xc0002a05e0, 0x3}, {0x0, 0x0}, {0xc00001e600, 0x37}, {0x0, 0x0, ...}, ...}) C:/Users/vho/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.35/pkg/runtime/dialog.go:39 +0x98 main.(*App).OpenDirectoryDialog(0xc00008dd40, {0x1243520, 0xc000177a70}) C:/MultiTech-Projects/GO Source Code Files/Web-Applications/Wails/utility-hub/app.go:158 +0x15e reflect.Value.call({0x1283c40, 0xc00008dd40, 0x1f1495e0598}, {0x12c31cf, 0x4}, {0xc000004468, 0x1, 0x1235dc0}) C:/Program Files/Go/src/reflect/value.go:556 +0x845 reflect.Value.Call({0x1283c40, 0xc00008dd40, 0xdc297a}, {0xc000004468, 0x1, 0x1}) C:/Program Files/Go/src/reflect/value.go:339 +0xc5 github.com/wailsapp/wails/v2/internal/binding.(*BoundMethod).Call(0xc0000e2ee0, {0xc000050710, 0x1, 0x120ffc0}) C:/Users/vho/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.35/internal/binding/boundMethod.go:73 +0x178 github.com/wailsapp/wails/v2/internal/frontend/dispatcher.(*Dispatcher).processCallMessage(0xc00005e080, {0xc0002f6340, 0xc5}, {0x2196ee8, 0xc000068000}) C:/Users/vho/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.35/internal/frontend/dispatcher/calls.go:45 +0x189 github.com/wailsapp/wails/v2/internal/frontend/dispatcher.(*Dispatcher).ProcessMessage(0x0, {0xc0002f6340, 0x0}, {0x2196ee8, 0xc000068000}) C:/Users/vho/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.35/internal/frontend/dispatcher/dispatcher.go:39 +0x5egithub.com/wailsapp/wails/v2/internal/frontend/desktop/windows.(*Frontend).processMessage.func1() C:/Users/vho/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.35/internal/frontend/desktop/windows/frontend.go:494 +0x3e created by github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.(*Frontend).processMessage C:/Users/vho/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.35/internal/frontend/desktop/windows/frontend.go:493 +0x225 ``` Please help!
barats
commented
1 month ago
Was it fixed?
Discussed in https://github.com/wailsapp/wails/discussions/1371