ospath

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ospath provides discovery of OS-dependent paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the directory where configuration data (possibly roaming) needs to be stored.

func IsAbs added in v0.9.3

func IsAbs(s string) bool

IsAbs determines if a given path is absolute, in particular treating \\hostname\share as absolute on Windows.

func LogsDir

func LogsDir() string

LogsDir returns the directory where per-user logs should be written.

func ResolveUserFriendlyPath added in v0.8.0

func ResolveUserFriendlyPath(path string, relativeToHome bool) string

ResolveUserFriendlyPath replaces ~ in a path with a home directory.

func SafeLongFilename added in v0.23.0

func SafeLongFilename(fname string) string

SafeLongFilename handles long absolute file paths in a platform-specific manner. Currently it only handles absolute paths on Windows. It is a no-op on other platforms.

On Windows, it prefixes the given filename with \\?\ when the filename length approximates MAX_PATH characters, which is required to be able to use some low-level Windows APIs.

Relative paths are always limited to a total of MAX_PATH characters: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

Types

This section is empty.

Jump to

Keyboard shortcuts

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