usrlocalsharelima

package
v2.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecutableViaArgs0 = sync.OnceValues(func() (string, error) {
	if os.Args[0] == "" {
		return "", errors.New("os.Args[0] has not been set")
	}
	executable, err := exec.LookPath(os.Args[0])
	if err == nil {
		executable, err = filepath.Abs(executable)
	}
	if err != nil {
		return "", fmt.Errorf("os.Args[0] is invalid: %w", err)
	}

	return executable, nil
})

ExecutableViaArgs0 returns the absolute path to the executable used to start this process. It will also append the file extension on Windows, if necessary. This function is different from os.Executable(), which will use /proc/self/exe on Linux and therefore will resolve any symlink used to locate the executable. This function will return the symlink instead because we want to be able to locate ../share/lima relative to the location of the symlink, and not the actual executable. This is important when using Homebrew.

Functions

func Dir

func Dir() (string, error)

Dir returns the location of the <PREFIX>/lima/share directory, relative to the location of the current executable. It checks for multiple possible filesystem layouts and returns the first candidate that contains the native guest agent binary.

func GuestAgentBinary

func GuestAgentBinary(ostype limatype.OS, arch limatype.Arch) (string, error)

GuestAgentBinary returns the absolute path of the guest agent binary, possibly with ".gz" suffix.

func LibexecLima

func LibexecLima() (string, error)

LibexecLima returns the <PREFIX>/libexec/lima directory.

func Prefix

func Prefix() (string, error)

Prefix returns the <PREFIX> directory, which is two levels above the lima share directory.

func SelfDirs

func SelfDirs() []string

SelfDirs returns a list of directory paths where the current executable might be located. It checks both os.Args[0] and os.Executable() methods and returns directories containing the executable, resolving symlinks as needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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