package storage
import "fyne.io/fyne/storage"
Package storage provides storage access and management functionality.
Index ¶
- Constants
- func Child(u fyne.URI, component string) (fyne.URI, error)
- func Exists(u fyne.URI) (bool, error)
- func ListerForURI(uri fyne.URI) (fyne.ListableURI, error)
- func NewFileURI(path string) fyne.URI
- func NewURI(u string) fyne.URI
- func OpenFileFromURI(uri fyne.URI) (fyne.URIReadCloser, error)
- func Parent(u fyne.URI) (fyne.URI, error)
- func SaveFileToURI(uri fyne.URI) (fyne.URIWriteCloser, error)
- type ExtensionFileFilter
- type FileFilter
- func NewExtensionFileFilter(extensions []string) FileFilter
- func NewMimeTypeFileFilter(mimeTypes []string) FileFilter
- type MimeTypeFileFilter
Constants ¶
const URIRootError uriRootError = uriRootError("Cannot take the parent of the root element in a URI")
URIRootError should be thrown by fyne.URI implementations when the caller attempts to take the parent of the root. This way, downstream code that wants to programmatically walk up a URIs parent's will know when to stop iterating.
Functions ¶
func Child ¶
Child appends a new path element to a URI, separated by a '/' character.
func Exists ¶
Exists will return true if the resource the URI refers to exists, and false otherwise. If an error occurs while checking, false is returned as the first return.
func ListerForURI ¶
func ListerForURI(uri fyne.URI) (fyne.ListableURI, error)
ListerForURI will attempt to use the application's driver to convert a standard URI into a listable URI.
func NewFileURI ¶
NewFileURI creates a new URI from the given file path.
func NewURI ¶
NewURI creates a new URI from the given string representation. This could be a URI from an external source or one saved from URI.String()
func OpenFileFromURI ¶
func OpenFileFromURI(uri fyne.URI) (fyne.URIReadCloser, error)
OpenFileFromURI loads a file read stream from a resource identifier. This is mostly provided so that file references can be saved using their URI and loaded again later.
func Parent ¶
Parent gets the parent of a URI by splitting it along '/' separators and removing the last item.
func SaveFileToURI ¶
func SaveFileToURI(uri fyne.URI) (fyne.URIWriteCloser, error)
SaveFileToURI loads a file write stream to a resource identifier. This is mostly provided so that file references can be saved using their URI and written to again later.
Types ¶
type ExtensionFileFilter ¶
type ExtensionFileFilter struct { Extensions []string }
ExtensionFileFilter represents a file filter based on the the ending of file names, for example ".txt" and ".png".
func (*ExtensionFileFilter) Matches ¶
func (e *ExtensionFileFilter) Matches(uri fyne.URI) bool
Matches returns true if a file URI has one of the filtered extensions.
type FileFilter ¶
FileFilter is an interface that can be implemented to provide a filter to a file dialog.
func NewExtensionFileFilter ¶
func NewExtensionFileFilter(extensions []string) FileFilter
NewExtensionFileFilter takes a string slice of extensions with a leading . and creates a filter for the file dialog. Example: .jpg, .mp3, .txt, .sh
func NewMimeTypeFileFilter ¶
func NewMimeTypeFileFilter(mimeTypes []string) FileFilter
NewMimeTypeFileFilter takes a string slice of mimetypes, including globs, and creates a filter for the file dialog. Example: image/*, audio/mp3, text/plain, application/*
type MimeTypeFileFilter ¶
type MimeTypeFileFilter struct { MimeTypes []string }
MimeTypeFileFilter represents a file filter based on the files mime type, for example "image/*", "audio/mp3".
func (*MimeTypeFileFilter) Matches ¶
func (mt *MimeTypeFileFilter) Matches(uri fyne.URI) bool
Matches returns true if a file URI has one of the filtered mimetypes.
Source Files ¶
file.go filter.go uri.go uri_root_error.go
- Version
- v1.4.0
- Published
- Nov 1, 2020
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 4 hours ago –
Tools for package owners.