hostfile

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hostfile reaches the user's desktop configuration (mimeapps.list, browser manifests) where it lives: the plain file call outside a Flatpak, a host sh script through flatpak-spawn inside one, which is not granted those files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigHome

func ConfigHome(home string) string

ConfigHome is the host's XDG config folder; a Flatpak's own XDG_CONFIG_HOME points into its sandbox.

func Exec

func Exec(name string, args ...string) (string, error)

Exec is the Runner that starts a real process, with the AppImage's variables removed from its environment.

func Spawn added in v0.6.1

func Spawn(name string, args ...string) error

Spawn starts a real process like Exec and does not wait for it: the program may be a handler the user keeps open. Its output is dropped and the process is reaped in the background.

Types

type Host

type Host struct{ Run Runner }

Host runs the file steps through Run.

func (Host) Command

func (h Host) Command(name string, args ...string) (string, error)

Command runs name where the user's desktop lives: directly, or from inside a Flatpak through flatpak-spawn, where name is looked up on the host's PATH.

func (Host) IsDir

func (h Host) IsDir(path string) bool

IsDir reports whether path is a folder.

func (Host) Read

func (h Host) Read(path string) ([]byte, error)

Read is the file's bytes, or fs.ErrNotExist.

func (Host) Remove

func (h Host) Remove(path string) error

Remove deletes the file; a missing one is no error.

func (Host) Resolve

func (h Host) Resolve(path string) string

Resolve follows a symlink (a dotfile manager's), so a rewrite lands in its target and the link stays.

func (Host) Write

func (h Host) Write(path string, b []byte, perm fs.FileMode) error

Write replaces the file whole, creating its folder.

type Runner

type Runner func(name string, args ...string) (string, error)

Runner runs a command and returns its standard output.

Jump to

Keyboard shortcuts

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