File: home.go

package info (click to toggle)
golang-github-rkoesters-xdg 0.0~git20181125.edd15b8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 220 kB
  • sloc: makefile: 5
file content (39 lines) | stat: -rw-r--r-- 1,226 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package trash

import (
	"github.com/rkoesters/xdg/basedir"
	"path/filepath"
)

var hometrash *Dir

func init() {
	hometrash = &Dir{filepath.Join(basedir.DataHome, "Trash")}
}

// Files returns a slice of the files in the default trash.
func Files() ([]string, error) { return hometrash.Files() }

// Stat returns the Info for the given file in the trash.
func Stat(s string) (*Info, error) { return hometrash.Stat(s) }

// Trash moves the given file to the trash.
func Trash(p string) error { return hometrash.Trash(p) }

// Restore moves the file from the trash to its original location.
func Restore(s string) error { return hometrash.Restore(s) }

// RestoreTo moves the file from the trash to the specified location.
func RestoreTo(s, p string) error { return hometrash.RestoreTo(s, p) }

// Erase removes the given file from the trash.
func Erase(s string) error { return hometrash.Erase(s) }

// EraseAll removes the given file and all children from the trash.
func EraseAll(s string) error { return hometrash.EraseAll(s) }

// Empty erases all files in the trash.
func Empty() error { return hometrash.Empty() }

// IsEmpty returns whether or not the trash is empty.
func IsEmpty() bool { return hometrash.IsEmpty() }