utils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONE    PathType = -1
	DIR     PathType = 0
	FILE    PathType = 1
	CONFDIR string   = "/etc/dotfilesync"
)

Variables

View Source
var Layout = "2006-01-02 15:04:05"

Functions

func CheckIfError

func CheckIfError(err error)

func CopyFile

func CopyFile(source string, dest string) error

func CreateFile

func CreateFile(filename string) error

func DirExists

func DirExists(path string) bool

Check if a dir exists

func DirFileSplit

func DirFileSplit(path string) (string, string)

Get only name of a file

func FileExists

func FileExists(path string) bool

Check if a file exist

func GetDate

func GetDate() string

func GetFileContent

func GetFileContent(path string) (string, error)

Get the contents of a file (non-buffered, so not ideal for large files)

func GetLastModified

func GetLastModified(path string) (time.Time, error)

Get the ModTime of a file

func GetLatestFormatDate

func GetLatestFormatDate(date1 string, date2 string) (string, error)

func IsDiff

func IsDiff(path1 string, path2 string) (bool, error)

Compare two files and calculate the difference. If a difference exists, return true, otherwise return false

func IsMoreRecent

func IsMoreRecent(path1 string, path2 string) (bool, error)

Compare the most recent ModTime of two files and determine if "path1" is more recent or not

func IsMoreRecentTime

func IsMoreRecentTime(t1 time.Time, t2 time.Time) bool

func IsSameTime added in v0.1.2

func IsSameTime(t1 time.Time, t2 time.Time) bool

func IsWritable added in v0.1.2

func IsWritable(filename string) bool

func Mkdir

func Mkdir(path string) error

func SetDefPermission

func SetDefPermission(path string) error

func WriteToFile

func WriteToFile(filename string, content string) error

Types

type PathType

type PathType int64

func PathExists

func PathExists(path string) (bool, PathType, error)

Jump to

Keyboard shortcuts

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