Adds getDirectoryPath() desktop (go) implementation
This commit is contained in:
parent
7598d4608f
commit
a141cf2fc7
|
@ -1,3 +1,6 @@
|
|||
## 1.12.0
|
||||
Adds `getDirectoryPath()` desktop (go) implementation.
|
||||
|
||||
## 1.11.0+3
|
||||
Updates tearDown() call order on Android's implementation.
|
||||
|
||||
|
|
|
@ -73,3 +73,11 @@ func fileDialog(title string, filter string) (string, error) {
|
|||
path := string(filepath.Separator) + filepath.Join(pathParts[1:]...)
|
||||
return path, nil
|
||||
}
|
||||
|
||||
func dirDialog(title string) (string, error) {
|
||||
dirPath, _, err := dlgs.File(title, `*.*`, true)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to open dialog picker")
|
||||
}
|
||||
return dirPath, nil
|
||||
}
|
||||
|
|
|
@ -37,3 +37,11 @@ func fileDialog(title string, filter string) (string, error) {
|
|||
}
|
||||
return filePath, nil
|
||||
}
|
||||
|
||||
func dirDialog(title string) (string, error) {
|
||||
dirPath, _, err := dlgs.File(title, `*.*`, true)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to open dialog picker")
|
||||
}
|
||||
return dirPath, nil
|
||||
}
|
||||
|
|
|
@ -13,3 +13,7 @@ func fileFilter(method string) (string, error) {
|
|||
func fileDialog(title string, filter string) (string, error) {
|
||||
return "", errors.New("platform unsupported")
|
||||
}
|
||||
|
||||
func dirDialog(title string, filter string) (string, error) {
|
||||
return "", errors.New("platform unsupported")
|
||||
}
|
||||
|
|
|
@ -37,3 +37,11 @@ func fileDialog(title string, filter string) (string, error) {
|
|||
}
|
||||
return filePath, nil
|
||||
}
|
||||
|
||||
func dirDialog(title string) (string, error) {
|
||||
dirPath, _, err := dlgs.File(title, `*.*`, true)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to open dialog picker")
|
||||
}
|
||||
return dirPath, nil
|
||||
}
|
||||
|
|
|
@ -21,7 +21,17 @@ func (p *FilePickerPlugin) InitPlugin(messenger plugin.BinaryMessenger) error {
|
|||
|
||||
func (p *FilePickerPlugin) handleFilePicker(methodCall interface{}) (reply interface{}, err error) {
|
||||
method := methodCall.(plugin.MethodCall).Method
|
||||
|
||||
if "dir" == method {
|
||||
dirPath, err := dirDialog("Select a directory")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to open dialog picker")
|
||||
}
|
||||
return dirPath, nil
|
||||
}
|
||||
|
||||
arguments := methodCall.(plugin.MethodCall).Arguments.(map[interface{}]interface{})
|
||||
|
||||
var allowedExtensions []string
|
||||
|
||||
// Parse extensions
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name: file_picker
|
||||
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
||||
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
||||
version: 1.11.0+3
|
||||
version: 1.12.0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
@ -23,5 +23,3 @@ flutter:
|
|||
pluginClass: FilePickerPlugin
|
||||
web:
|
||||
default_package: file_picker_web
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue