xdg

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DirHomeTrash string
)

Functions

func LookupTrashDir

func LookupTrashDir(path string) (home *TrashDir, external *TrashDir, err error)

Returns the trash directory associated with the file Return the home directory for fallback as well.

Types

type DirCache

type DirCache map[string]*struct {
	Item DirCacheItem
	Seen bool
}

func NewDirCache

func NewDirCache(r io.Reader) (DirCache, error)

func (DirCache) Save

func (c DirCache) Save(trashDir string, truncate bool) error

func (DirCache) ToFile

func (c DirCache) ToFile(truncate bool) string

type DirCacheItem

type DirCacheItem struct {
	Size    int64
	Mtime   time.Time
	DirName string
}

func (DirCacheItem) String

func (i DirCacheItem) String() string

type Info

type Info struct {
	Path         string    // $PWD/file.go (url decoded)
	DeletionDate time.Time // 2023-01-01T00:00:00
}

func NewInfo

func NewInfo(r io.Reader) (Info, error)

func (Info) Save

func (i Info) Save(trashDir TrashDir, filename string) (saveName string, deleteFn func() error, err error)

func (Info) String

func (i Info) String() string

represent INI format

type TrashDir

type TrashDir struct {
	Root string // $XDG_DATA_HOME or $rootDir (used for relative path)
	Dir  string // $XDG_DATA_HOME/Trash or $rootDir/.Trash/$uid or $rootDir/.Trash-$uid (has info and files directory)
	// contains filtered or unexported fields
}

func NewTrashDirManual added in v0.0.3

func NewTrashDirManual(dir string) TrashDir

func ScanTrashDirs

func ScanTrashDirs() []TrashDir

Scan and returns trash directories from all mountpoints The existence of the 'files' and 'info' directories is not checked

func (TrashDir) CreateDir

func (d TrashDir) CreateDir() error

func (TrashDir) FilesDir

func (d TrashDir) FilesDir() string

func (TrashDir) InfoDir

func (d TrashDir) InfoDir() string

func (TrashDir) UseRelativePath

func (d TrashDir) UseRelativePath() bool

Use relative paths for external trash

Jump to

Keyboard shortcuts

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