Documentation
¶
Overview ¶
Package platform provides cross-platform compatibility utilities.
Index ¶
- func Arch() string
- func CacheDir() string
- func CommonPaths() map[string]string
- func ConfigDir() string
- func DataDir() string
- func DefaultEnvVars() []string
- func DefaultShell() string
- func DeniedPaths() []string
- func EnsureWindowsBusybox() error
- func ExecutableExt() string
- func ExpandHome(path string) string
- func HomeDir() string
- func Is64Bit() bool
- func Is386() bool
- func IsAIX() bool
- func IsAMD64() bool
- func IsARM() bool
- func IsARM64() bool
- func IsBSD() bool
- func IsDragonflyBSD() bool
- func IsExecutable(info os.FileMode) bool
- func IsFreeBSD() bool
- func IsLinux() bool
- func IsLittleEndian() bool
- func IsMacOS() bool
- func IsNetBSD() bool
- func IsOpenBSD() bool
- func IsPlan9() bool
- func IsSolaris() bool
- func IsUnix() bool
- func IsWindows() bool
- func JoinPath(elem ...string) string
- func NormalizePath(path string) string
- func OS() string
- func OpenFile(path string) error
- func PathSeparator() string
- func SandboxPaths() []string
- func SessionDir() string
- func ShellArgs(shell, command string) []string
- func SkillsDir() string
- func TempDir() string
- func WindowsBusyboxPath() (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonPaths ¶
CommonPaths returns platform-specific common system paths.
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the platform-specific configuration directory.
func DefaultEnvVars ¶
func DefaultEnvVars() []string
DefaultEnvVars returns environment variables to pass through sandbox.
func DefaultShell ¶
func DefaultShell() string
DefaultShell returns the default shell for the current platform.
func DeniedPaths ¶
func DeniedPaths() []string
DeniedPaths returns paths that should be denied in sandbox mode.
func EnsureWindowsBusybox ¶
func EnsureWindowsBusybox() error
EnsureWindowsBusybox is a no-op on non-Windows platforms.
func ExecutableExt ¶
func ExecutableExt() string
ExecutableExt returns the platform-specific executable extension.
func ExpandHome ¶
ExpandHome expands ~ to the user's home directory.
func IsBSD ¶
func IsBSD() bool
IsBSD returns true if running on any BSD variant (FreeBSD, OpenBSD, NetBSD, DragonFly BSD).
func IsDragonflyBSD ¶
func IsDragonflyBSD() bool
IsDragonflyBSD returns true if running on DragonFly BSD.
func IsExecutable ¶
IsExecutable checks if a file is executable on the current platform.
func IsLittleEndian ¶
func IsLittleEndian() bool
IsLittleEndian returns true if the architecture is little-endian. Returns true for most modern architectures; false for s390x, ppc64 (BE), mips64 (BE).
func IsUnix ¶
func IsUnix() bool
IsUnix returns true if running on a Unix-like OS (Linux, macOS, BSD, Solaris, illumos, AIX).
func NormalizePath ¶
NormalizePath normalizes a path for the current platform. Converts forward slashes to backslashes on Windows.
func OS ¶
func OS() string
OS returns the current operating system: "windows", "darwin", "linux", etc.
func PathSeparator ¶
func PathSeparator() string
PathSeparator returns the platform-specific path separator.
func SandboxPaths ¶
func SandboxPaths() []string
SandboxPaths returns paths that should be accessible in sandbox mode.
func SessionDir ¶
func SessionDir() string
SessionDir returns the platform-specific session directory.
func WindowsBusyboxPath ¶
WindowsBusyboxPath is unavailable on non-Windows platforms.
Types ¶
This section is empty.