system

package
v3.9.6 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsPath

func AbsPath(path string) string

AbsPath returns the absolute path of `path`.

func DeterminePath

func DeterminePath(configPath string, keyPath string) string

DeterminePath determines the path of `keyPath` based on `configPath`.

If `keyPath` is an absolute path, it is returned as is.

If `keyPath` is a relative path, it is joined with `configPath`.

If `configPath` is not a directory, the directory part of `configPath` is used.

func FileExists

func FileExists(filename string) bool

FileExists determines if the path given by `filename` exists.

func FileNameWithoutExt

func FileNameWithoutExt(fileName string) string

FileNameWithoutExt returns the filename without its extension.

func IsDir

func IsDir(filename string) bool

IsDir determines if the path given by `filename` is a directory.

func IsLinux

func IsLinux() bool

IsLinux returns true if the current OS is Linux.

func IsMac

func IsMac() bool

IsMac returns true if the current OS is macOS.

func IsUnix

func IsUnix() bool

IsUnix returns true if the current OS is either macOS or Linux.

func IsWindows

func IsWindows() bool

IsWindows returns true if the current OS is Windows.

func Mkdir

func Mkdir(dir string) error

Mkdir creates a directory at the given path.

func Name

func Name() string

Name returns the current OS.

func NormalizePath

func NormalizePath(path string) string

NormalizePath expands a tilde and returns the absolute path of `path`.

func PlatformAndArch

func PlatformAndArch() string

PlatformAndArch returns the current platform and architecture.

func ReplaceFileExt

func ReplaceFileExt(fp string, formats map[string]string) string

ReplaceExt replaces the extension of `fp` with `ext` if the extension of `fp` is in `formats`.

This is used in places where we need to normalize file extensions (e.g., `foo.mdx` -> `foo.md`) in order to respect format associations.

func Unarchive

func Unarchive(src, dest string) error

Unarchive extracts a ZIP archive to a destination directory.

func Walk

func Walk(path string, walkFn filepath.WalkFunc) error

Walk extends filepath.Walk to also follow symlinks

func Which

func Which(cmds []string) string

Which checks for the existence of any command in `cmds`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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