Documentation ¶
Overview ¶
Package osutil provides additional platform-independent access to operating system functionality.
Index ¶
- func CleanupArgs()
- func Copy(src, dst string) (err error)
- func CreateConsole() error
- func GetANSIPath(path string) (string, error)
- func HiddenFile(de os.DirEntry) bool
- func Lnky(src, dst string) error
- func Move(src, dst string) error
- func NewFile(name string) (*os.File, error)
- func SetPriority(proc os.Process, prio PriorityClass) error
- func ShellOpen(file string) error
- type PriorityClass
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupArgs ¶
func CleanupArgs()
CleanupArgs cleans up os.Args. On macOS, it removes the Process Serial Number arg.
func CreateConsole ¶
func CreateConsole() error
CreateConsole ensures a Windows process has an attached console. If needed, it creates an hidden console and attaches to it.
func GetANSIPath ¶
GetANSIPath converts path so that it is valid for use with Windows ANSI APIs. Outside of Windows, path is returned unchanged.
On Windows, if path length exceeds MAX_PATH, or if it contains characters that cannot be represented in the system's ANSI code page, GetShortPathName is used to try to construct an equivalent, valid path.
Note: path is assumed to be UTF-8 encoded, and is returned UTF-8 encoded. GetANSIPath can be used to obtain an equivalent path that you can offer as a command line argument to an external program that uses ANSI APIs, not to encode path so that you can access ANSI APIs directly.
func HiddenFile ¶
HiddenFile reports whether de is hidden. Files starting with a period are reported as hidden on all systems, even Windows. Other than that, plaform rules apply.
func Move ¶
Move moves src to dst. Tries os.Rename. Failing that, does a Copy followed by a os.Remove.
func NewFile ¶
NewFile creates a new named file. If the file already exists, a numeric suffix is appended or incremented.
func SetPriority ¶ added in v0.10.0
func SetPriority(proc os.Process, prio PriorityClass) error
SetPriority sets the scheduling priority of proc.
Types ¶
type PriorityClass ¶ added in v0.10.0
type PriorityClass int
const ( Realtime PriorityClass = -20 High PriorityClass = -16 AboveNormal PriorityClass = -8 Normal PriorityClass = 0 BelowNormal PriorityClass = 8 Idle PriorityClass = 16 )