Documentation ¶
Index ¶
- func IsZipPath(p string) bool
- func ZipFilePath(path string) (zipFilename, filename string)
- func ZipFilename(zipFilename, filenameInZip string) string
- func ZipPathDisplayName(path string) string
- type Deleter
- type FSHasher
- type FileBased
- type Hasher
- type RenamerRemover
- type Scanned
- type Scanner
- type SourceFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsZipPath ¶
IsZipPath returns true if the path includes the zip separator byte, indicating it is within a zip file.
func ZipFilePath ¶
func ZipFilename ¶
func ZipPathDisplayName ¶
ZipPathDisplayName converts an zip path for display. It translates the zip file separator character into '/', since this character is also used for path separators within zip files. It returns the original provided path if it does not contain the zip file separator character.
Types ¶
type Deleter ¶ added in v0.12.0
type Deleter struct { RenamerRemover RenamerRemover // contains filtered or unexported fields }
Deleter is used to safely delete files and directories from the filesystem. During a transaction, files and directories are marked for deletion using the Files and Dirs methods. This will rename the files/directories to be deleted. If the transaction is rolled back, then the files/directories can be restored to their original state with the Abort method. If the transaction is committed, the marked files are then deleted from the filesystem using the Complete method.
func NewDeleter ¶ added in v0.12.0
func NewDeleter() *Deleter
func (*Deleter) Commit ¶ added in v0.12.0
func (d *Deleter) Commit()
Commit deletes all files marked for deletion and clears the marked list. Any errors encountered are logged. All files will be attempted, regardless of the errors encountered.
func (*Deleter) Dirs ¶ added in v0.12.0
Dirs designates directories to be deleted. Each directory marked will be renamed to add a `.delete` suffix. An error is returned if a directory could not be renamed. Note that if an error is returned, then some directories may be left renamed. Abort should be called to restore marked files/directories if this function returns an error.
func (*Deleter) Files ¶ added in v0.12.0
Files designates files to be deleted. Each file marked will be renamed to add a `.delete` suffix. An error is returned if a file could not be renamed. Note that if an error is returned, then some files may be left renamed. Abort should be called to restore marked files if this function returns an error.
type RenamerRemover ¶ added in v0.12.0
type RenamerRemover interface { Rename(oldpath, newpath string) error Remove(name string) error RemoveAll(path string) error Stat(name string) (fs.FileInfo, error) }
RenamerRemover provides access to the Rename and Remove functions.
type Scanned ¶
func (Scanned) ContentsChanged ¶
ContentsChanged returns true if both old and new files are present and the file content is different.
func (Scanned) FileUpdated ¶
FileUpdated returns true if both old and new files are present and not equal.
type Scanner ¶
func (Scanner) ScanExisting ¶
func (o Scanner) ScanExisting(existing FileBased, file SourceFile) (h *Scanned, err error)