Skip to content

Instantly share code, notes, and snippets.

@vendion
Last active September 15, 2015 02:02
Show Gist options
  • Save vendion/ce97e6c9bb0a94ac29f6 to your computer and use it in GitHub Desktop.
Save vendion/ce97e6c9bb0a94ac29f6 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"os"
filepath "path"
)
func main() {
path := fmt.Sprintf("%s/Library/LaunchAgents", os.Getenv("HOME"))
files := findPlists(path)
fmt.Printf("%#s\n", files)
}
func findPlists(path string) []string {
dir, err := ioutil.ReadDir(path)
if err != nil {
return []string{}
}
plists := []string{}
for _, f := range dir {
ext := filepath.Ext(f.Name())
if ext == ".plist" {
plists = append(plists, f.Name())
}
}
return plists
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment