fileio

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChecksumFile

func ChecksumFile(src string) (string, error)

ChecksumFile calculate the checksum of a file This is used only internally to compare files

func CompareFiles

func CompareFiles(fileA, fileB string) (bool, error)

CompareFiles compares two files returns True if files are the same

func CopyFile

func CopyFile(src string, dest string) error

CopyFile copies file contents from file source to file destination

func FileExists

func FileExists(src string) bool

FileExists checks if the file exists

func GetExecutable

func GetExecutable() (string, error)

GetExecutable get the path to the current executable

func TempDir

func TempDir() (string, error)

TempDir creates a new temporary directory

Types

type Patcher

type Patcher struct {
	SourcePath      string
	DestinationPath string
	BackupPath      string      // Stores the backup of DestinationPath before replacement (must be on the same filesytem as DestinationPath)
	Mode            os.FileMode // Mode used to create the new file at DestinationPath
}

Patcher is used to replace file located at DestinationPath with the one located at SourcePath. DestinationPath is backed up at BackupPath.

func (*Patcher) Apply

func (p *Patcher) Apply() error

Apply replaces the file located at DestinationPath with the one located at BackupPath and then new file is created at DestinationPath with the content of SourcePath

func (*Patcher) CleanUp

func (p *Patcher) CleanUp() error

CleanUp cleans up backup file

func (*Patcher) Rollback

func (p *Patcher) Rollback() error

Rollback replaces the file located at BackupPath with the one located at DestinationPath.

Jump to

Keyboard shortcuts

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