platform

package
v0.6.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EnvArch     = "GDENV_ARCH"
	EnvOS       = "GDENV_OS"
	EnvPlatform = "GDENV_PLATFORM"
)

Variables

View Source
var (
	ErrMissingArch      = errors.New("missing architecture")
	ErrUnrecognizedArch = errors.New("unrecognized architecture")
)
View Source
var (
	ErrMissingOS      = errors.New("missing OS")
	ErrUnrecognizedOS = errors.New("unrecognized OS")
)
View Source
var (
	ErrMissingPlatform      = errors.New("missing platform")
	ErrUnrecognizedPlatform = errors.New("unrecognized platform")
)

Functions

func Format

func Format(p Platform, v version.Version) (string, error)

Formats a 'Platform' specification into a platform string found in Godot executable names.

NOTE: This method delegates to rather complex OS-specific methods. It would be great if there were a better way to organize this.

NOTE: This is a best effort implementation. Please open an issue on GitHub if some platform identifiers are missing or incorrect: github.com/coffeebeats/gdenv/issues/new?labels=bug&template=%F0%9F%90%9B-bug-report.md.

Types

type Arch

type Arch int

CPU architectures which the Godot project provides prebuilt editor binaries for.

const (
	Amd64 Arch = iota + 1
	Arm64
	I386
	Universal
)

func MustParseArch

func MustParseArch(input string) Arch

Parses an input string as a CPU architecture specification but panics if it would fail.

func ParseArch

func ParseArch(input string) (Arch, error)

Parses an input string as a CPU architecture specification. Typically this will rely on the 'os.GOARCH' value, but users may override that setting via an environment variable. As such, this function recognizes some values in addition to what Go defines.

NOTE: This is a best effort implementation. Please open an issue on GitHub if some values are missing: github.com/coffeebeats/gdenv/issues/new?labels=bug&template=%F0%9F%90%9B-bug-report.md.

func (Arch) String

func (a Arch) String() string

type OS

type OS int

Operating systems which the Godot project provides prebuilt editor binaries for.

const (
	Linux OS = iota + 1
	MacOS
	Windows
)

func MustParseOS

func MustParseOS(input string) OS

Parses an input string as an operating system specification but panics if it would fail.

func ParseOS

func ParseOS(input string) (OS, error)

Parses an input string as an operating system specification. Typically this will rely on the 'GOOS' value, but users may override that setting via an environment variable. As such, this function recognizes some values in addition to what Go defines.

NOTE: This is a best effort implementation. Please open an issue on GitHub if some values are missing: github.com/coffeebeats/gdenv/issues/new?labels=bug&template=%F0%9F%90%9B-bug-report.md.

func (OS) String

func (o OS) String() string

type Platform

type Platform struct {
	Arch Arch
	OS   OS
}

A platform specification representing a target to run the Godot editor on.

func Detect

func Detect() (Platform, error)

Resolves the target platform by first checking environment variables and then falling back to the host platform.

func MustParse

func MustParse(input string) Platform

Parses an input string as a 'Platform' specification but panics if it would fail.

func Parse

func Parse(input string) (Platform, error)

Parses a 'Platform' struct from a platform identifier. There are potentially multiple valid identifiers for any given platform due to schema differences across Godot versions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL