Print unknown links.

This commit is contained in:
Stephen McQuay 2016-01-11 23:10:27 -08:00
parent 429eb02d64
commit a35a09511c

14
main.go
View File

@ -70,6 +70,7 @@ func main() {
} }
} }
case "list", "ls": case "list", "ls":
known := map[string]bool{}
dirs, err := ioutil.ReadDir(saves) dirs, err := ioutil.ReadDir(saves)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "could not read saves dir: %+v\n", err) fmt.Fprintf(os.Stderr, "could not read saves dir: %+v\n", err)
@ -82,6 +83,19 @@ func main() {
status = "m" status = "m"
} }
fmt.Printf("%s %s\n", status, dir.Name()) fmt.Printf("%s %s\n", status, dir.Name())
known[dir.Name()] = true
}
dirs, err = ioutil.ReadDir(appSupport)
if err != nil {
fmt.Fprintf(os.Stderr, "could not read saves dir: %+v\n", err)
os.Exit(1)
}
for _, dir := range dirs {
if dir.Mode()&os.ModeSymlink == os.ModeSymlink {
if _, ok := known[dir.Name()]; !ok {
fmt.Fprintf(os.Stderr, "? %s\n", dir.Name())
}
}
} }
default: default:
fmt.Fprintf(os.Stderr, "%s\n", usage) fmt.Fprintf(os.Stderr, "%s\n", usage)