Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUserDecline is returned when the user doesn't select the file. ErrUserDecline = errors.New("user exit the file selector without selecting a file") // ErrNotAvailable is return when the current OS isn't supported. ErrNotAvailable = errors.New("current OS not supported") )
Functions ¶
func ListenEvents ¶
ListenEvents must get all the events from Gio, in order to get the GioView. You must include that function where you listen for Gio events.
Similar as:
select { case e := <-window.Events():
explorer.ListenEvents(e) switch e := e.(type) { (( ... your code ... )) } }
func ReadFile ¶
func ReadFile(extensions ...string) (io.ReadCloser, error)
ReadFile shows the file selector, allowing the user to select a single file. Optionally, it's possible to define which file extensions is supported to be selected (such as `.jpg`, `.png`).
Example: ReadFile(".jpg", ".png") will only accept the selection of files with .jpg or .png extensions.
In some platforms the resulting `io.ReadCloser` is a `os.File`, but it's not a guarantee.
func WriteFile ¶
func WriteFile(name string) (io.WriteCloser, error)
WriteFile opens the file selector, and writes the given content into some file, which the use can choose the location.
It's important to close the `io.WriteCloser`. In some platforms the file will be saved only when the writer is closer.
In some platforms the resulting `io.ReadCloser` is a `os.File`, but it's not a guarantee.
Types ¶
This section is empty.