expanduser

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LookupEnvFunc = os.LookupEnv

LookupEnvFunc is a function used to get environment variables. It is useful for unit testing.

Functions

func ExpandUser

func ExpandUser(path string) string

ExpandUser expands a tidle prefix of the specified path by calling either Posix or NT.

func Home

func Home() (string, error)

Home returns the home directory by calling either HomeNT or HomePosix.

func HomeNT

func HomeNT() (string, error)

HomeNT returns the home directory of the current user using Windows semantics.

func HomePosix

func HomePosix() (string, error)

HomePosix returns the home directory of the current user using non-Windows semantics. If the HOME environment variable is present it returns its value. Otherwise, it looks for an entry in the /etc/passwd file with at least 6 fields and a uid equal to os.Getuid(). If such an entry is found then returns the 6th field of the entry. If the before mentioned return conditions cannot be met an error is returned.

func NT

func NT(path string) string

NT expands a tidle prefix of the specified path using Windows semantics. Ported from expanduser in https://github.com/python/cpython/blob/master/Lib/ntpath.py.

func Posix

func Posix(path string) string

Posix expands a tidle prefix of the specified path using posix semantics. Ported from expanduser https://github.com/python/cpython/blob/master/Lib/posixpath.py.

Types

This section is empty.

Jump to

Keyboard shortcuts

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