Last active
September 15, 2015 02:02
-
-
Save vendion/ce97e6c9bb0a94ac29f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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