Documentation
¶
Index ¶
- Variables
- func ConfigureHTTPTransport()
- func DownloadHTTPFile(opts DownloaderArgs) error
- func DownloadSMBFile(opts DownloaderArgs) error
- func InstallRemoteFile(ctx context.Context, cfg *config.Instance, pl platforms.Platform, ...) (string, error)
- func InstallRemoteMedia(ctx context.Context, cfg *config.Instance, pl platforms.Platform, ...) (string, error)
- type AuthTransport
- type DownloaderArgs
- type RemoteMedia
Constants ¶
This section is empty.
Variables ¶
var ErrInsufficientSpace = errors.New("not enough free space for download")
ErrInsufficientSpace is a download that would not fit on the disk.
var ErrUnsafeArchive = errors.New("unsafe archive entry")
ErrUnsafeArchive is an archive entry that cannot be written safely: one that names a path outside the extraction folder, a link, or a device.
var ErrUnsafeMediaName = errors.New("remote media name is not a plain filename")
ErrUnsafeMediaName is returned for a download URL whose last path segment is not a plain filename. The name comes from a remote server, so it decides where on this device the download lands.
Functions ¶
func ConfigureHTTPTransport ¶ added in v2.11.0
func ConfigureHTTPTransport()
ConfigureHTTPTransport applies the process TLS root configuration to the installer's custom timeout transport.
func DownloadHTTPFile ¶
func DownloadHTTPFile(opts DownloaderArgs) error
func DownloadSMBFile ¶
func DownloadSMBFile(opts DownloaderArgs) error
func InstallRemoteFile ¶
func InstallRemoteMedia ¶ added in v2.23.0
func InstallRemoteMedia( ctx context.Context, cfg *config.Instance, pl platforms.Platform, ui *uievents.Service, media *RemoteMedia, downloader func(opts DownloaderArgs) error, ) (string, error)
InstallRemoteMedia downloads media into the system's game folder, unless it is already there, and returns the local path to launch.
Types ¶
type AuthTransport ¶
type AuthTransport struct {
Base http.RoundTripper
}
type DownloaderArgs ¶
type DownloaderArgs struct {
// contains filtered or unexported fields
}
type RemoteMedia ¶ added in v2.23.0
type RemoteMedia struct {
// URL is fetched with the downloader.
URL string
// SystemID decides which folder the download lands in.
SystemID string
// FileName is the name saved on disk, or for an archive the folder it
// is extracted into. Empty takes the last segment of URL.
FileName string
// DisplayName is shown while downloading. Empty uses the file name.
DisplayName string
// PreNotice is shown once the media is ready, before it launches.
PreNotice string
// LaunchExts are the extensions the system's launchers open, used to
// pick the file to start from an extracted archive.
LaunchExts []string
// Size is the download size in bytes when known, so a download that
// cannot fit is refused before it starts. Zero skips the check.
Size int64
// Archive is a zip of a game made of several files. It is extracted
// into a folder named FileName and the zip deleted.
Archive bool
}
RemoteMedia describes a game or media file to fetch onto the device.