Documentation ¶
Overview ¶
Package osutil implements utilities for native OS support.
Index ¶
- Variables
- func Copy(from, to string) (err error)
- func ExpandTilde(path string) (string, error)
- func GetLans() ([]*net.IPNet, error)
- func Glob(pattern string) (matches []string, err error)
- func HideConsole()
- func HideFile(path string) error
- func InWritableDir(fn func(string) error, path string) error
- func IsWindowsExecutable(path string) bool
- func Lstat(name string) (fi os.FileInfo, err error)
- func NativeFilename(s string) string
- func NormalizedFilename(s string) string
- func Remove(path string) error
- func Rename(from, to string) error
- func ShowFile(path string) error
- func TryRename(from, to string) error
- type ReplacingWriter
Constants ¶
This section is empty.
Variables ¶
var ErrNoHome = errors.New("No home directory found - set $HOME (or the platform equivalent).")
Functions ¶
func Copy ¶ added in v0.10.21
Copy copies the file content from source to destination. Tries hard to succeed on various systems by temporarily tweaking directory permissions and removing the destination file when necessary.
func ExpandTilde ¶ added in v0.10.0
func HideConsole ¶ added in v0.10.10
func HideConsole()
func InWritableDir ¶ added in v0.10.0
InWritableDir calls fn(path), while making sure that the directory containing `path` is writable for the duration of the call.
func IsWindowsExecutable ¶ added in v0.11.3
IsWindowsExecutable returns true if the given path has an extension that is in the list of executable extensions.
func Lstat ¶ added in v0.11.0
Lstat is like os.Lstat, except lobotomized for Android. See https://forum.syncthing.net/t/2395
func NativeFilename ¶ added in v0.10.7
func NormalizedFilename ¶ added in v0.10.7
func Remove ¶ added in v0.11.0
Remove removes the given path. On Windows, removes the read-only attribute from the target prior to deletion.
func Rename ¶
Rename moves a temporary file to it's final place. 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. Tries hard to succeed on various systems by temporarily tweaking directory permissions and removing the destination file when necessary.