I found it more legible if docs didn't end in a '/'

This commit is contained in:
Stephen McQuay 2016-01-09 11:07:33 -08:00
parent 92debfd3a3
commit 0f2b6d7987

View File

@ -24,7 +24,7 @@ func main() {
fmt.Fprintf(os.Stderr, "cannot calculate home dir: %v", err) fmt.Fprintf(os.Stderr, "cannot calculate home dir: %v", err)
os.Exit(1) os.Exit(1)
} }
docs := fmt.Sprintf("%s/Documents/", u.HomeDir) docs := fmt.Sprintf("%s/Documents", u.HomeDir)
saves := fmt.Sprintf("%s/Documents/saves", u.HomeDir) saves := fmt.Sprintf("%s/Documents/saves", u.HomeDir)
appSupport := fmt.Sprintf("%s/Library/Application Support", u.HomeDir) appSupport := fmt.Sprintf("%s/Library/Application Support", u.HomeDir)
if len(os.Args) != 2 { if len(os.Args) != 2 {
@ -35,9 +35,9 @@ func main() {
var cmd *exec.Cmd var cmd *exec.Cmd
switch os.Args[1] { switch os.Args[1] {
case "pull": case "pull":
cmd = exec.Command("rsync", "-auv", "sj.mcquay.me:~/docs/saves", docs) cmd = exec.Command("rsync", "-auv", "sj.mcquay.me:~/docs/saves", fmt.Sprintf("%s/", docs))
case "push": case "push":
cmd = exec.Command("rsync", "-auv", fmt.Sprintf("%ssaves", docs), "sj.mcquay.me:~/docs/") cmd = exec.Command("rsync", "-auv", fmt.Sprintf("%s/saves", docs), "sj.mcquay.me:~/docs/")
case "link": case "link":
dirs, err := ioutil.ReadDir(saves) dirs, err := ioutil.ReadDir(saves)
if err != nil { if err != nil {