diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-01-29 13:37:52 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-03-21 14:13:05 -0400 |
commit | 7bf7d5aa5c1df452fd88f26026f129fd9b49fbe1 (patch) | |
tree | b5314b4ef2c470e169d6dec9415f2b32f63b7403 /.config/wmii-hg/rbar_util/util.go | |
parent | affee5f76f0cd83ec28179b30456f311b82ea450 (diff) |
wmii: rbar_clock: re-implement in C
Diffstat (limited to '.config/wmii-hg/rbar_util/util.go')
-rw-r--r-- | .config/wmii-hg/rbar_util/util.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/.config/wmii-hg/rbar_util/util.go b/.config/wmii-hg/rbar_util/util.go deleted file mode 100644 index 9e5d622..0000000 --- a/.config/wmii-hg/rbar_util/util.go +++ /dev/null @@ -1,49 +0,0 @@ -package rbar_util - -import ( - "os" - "io" - "path/filepath" - "strings" - "errors" - - "fmt" -) - -func GlobEscape(lit string) string { - glob := lit - glob = strings.Replace(glob, "\\", "\\\\", -1) - glob = strings.Replace(glob, "*", "\\*", -1) - glob = strings.Replace(glob, "?", "\\?", -1) - glob = strings.Replace(glob, "[", "\\[", -1) - return glob -} - -var NoRbar = errors.New("no WMII rbars found") - -func Write(filename string, msg string) error { - dirnames, _ := filepath.Glob(GlobEscape(os.Getenv("XDG_RUNTIME_DIR"))+"/wmii*/rbar") - if len(dirnames) == 0 { - return NoRbar - } - for _, dirname := range dirnames { - file, err := os.OpenFile(filepath.Join(dirname, filename), os.O_WRONLY| os.O_APPEND|os.O_CREATE, 0666) - if err != nil { - continue - } - io.WriteString(file, msg) - file.Close() - } - return nil -} - -func Remove(glob string) { - fmt.Println("remove", glob); - fullglob := GlobEscape(os.Getenv("XDG_RUNTIME_DIR"))+"/wmii*/rbar/"+glob - fmt.Println("glob", fullglob) - filenames, err := filepath.Glob(fullglob) - fmt.Println("globerr", err) - for _, filename := range filenames { - os.Remove(filename) - } -} |