sys

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectoryClear

func DirectoryClear(dir string) error

DirectoryClear recursively empties a directory. Basically, it applies RemoveAll to the contents of the directory. This is different than RemoveAll on the directory, as it does not remove the directory itself.

func DirectoryCopy

func DirectoryCopy(src, dst string) (err error)

DirectoryCopy copies the src directory to the destination directory. The destination directory will be the parent of the resulting directory, and the result will have the same name as the source. If the destination already exists, it will perform a kind of merge, where existing files will not be touched, and only new files will be copied. If you want to replace the destination, delete it first. dst must exist.

func FileCopy

func FileCopy(src, dst string) (err error)

Copy copies the src file to the destination. The destination file must either exist, or the directory in the file's path must exist.

func FileCopyIfNewer

func FileCopyIfNewer(src, dst string) (err error)

CopyIfNewer performs a copy to the destination if the src is newer than the destination, or the destination does not exist.

func FileModDateCompare

func FileModDateCompare(file1, file2 string) (diff int, err error)

FileModDateCompare compares the modification date of two files, and returns -1 if the first is older than the second, 0 if they are the same, and 1 if the 2nd is older than the first. Returns an error if either is not a file.

func LaunchChrome

func LaunchChrome(url string, headless bool) (err error)

LaunchChromeHeadlessBrowser will launch google chrome with the given url. headless will launch it as a headless browser. One nice feature of google chrome is that you can launch it, give it a URL, and then the browser will listen for the URL and load it once the server on the other end becomes active.

func LaunchDefaultBrowser

func LaunchDefaultBrowser(url string) (err error)

func PathExists

func PathExists(path string) bool

PathExists returns true if the given path exists in the OS. This does not necessarily mean that the path is usable. It may be write or read protected. But at least you know its there.

Types

This section is empty.

Jump to

Keyboard shortcuts

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