userpath

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: AGPL-3.0 Imports: 6 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 userpath edits the current user's Windows PATH.

Index

Constants

View Source
const InstallerFlag = "--installer-user-path"

InstallerFlag is the hidden argument the Windows installer passes to the app: "<exe> --installer-user-path add|remove".

Variables

View Source
var ErrMalformed = errors.New("userpath: unbalanced quote in PATH")

ErrMalformed indicates an unbalanced quote in the PATH value.

Functions

func Add

func Add(value, dir string, expand func(string) string) (string, bool, error)

Add returns value with dir appended as one more entry of a Windows PATH list, and whether it changed. dir is quoted when it contains ';'.

func Remove

func Remove(value, dir string, expand func(string) string) (string, bool, error)

Remove returns value without the entries that name dir, and whether it changed. Other entries, including empty ones, keep their exact text.

func RunInstaller

func RunInstaller(args []string) (code int, ok bool)

RunInstaller handles args when they are the installer's hidden command and returns the process exit code: 0 on success (changed or already right), 1 on failure, 2 on bad arguments. ok is false for any other args.

func UpdateUser

func UpdateUser(add bool, dir string) (changed bool, err error)

UpdateUser adds or removes dir in the current user's Windows PATH.

Types

This section is empty.

Jump to

Keyboard shortcuts

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