osutil

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2014 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package osutil implements utilities for native OS support.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoHome = errors.New("No home directory found - set $HOME (or the platform equivalent).")

Functions

func ExpandTilde added in v0.10.0

func ExpandTilde(path string) (string, error)

func HideFile

func HideFile(path string) error

func InWritableDir added in v0.10.0

func InWritableDir(fn func(string) error, path string) error

InWritableDir calls fn(path), while making sure that the directory containing `path` is writable for the duration of the call.

func NativeFilename added in v0.10.7

func NativeFilename(s string) string

func NormalizedFilename added in v0.10.7

func NormalizedFilename(s string) string

func Rename

func Rename(from, to string) error

Rename renames a file, while trying hard to succeed on various systems by temporarily tweaking directory permissions and removing the destination file when necessary. Will make sure to delete the from file if the operation fails, so use only for situations like committing a temp file to it's final location.

func ShowFile

func ShowFile(path string) error

Types

type ReplacingWriter added in v0.10.3

type ReplacingWriter struct {
	Writer io.Writer
	From   byte
	To     []byte
}

func (ReplacingWriter) Write added in v0.10.3

func (w ReplacingWriter) Write(bs []byte) (int, error)

Jump to

Keyboard shortcuts

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