Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion pinfinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
"io"
"os"
"os/user"
"os/exec"
"path"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -108,7 +109,23 @@ func appendIfDir(dirs []string, dir string) []string {
return dirs
}

// figure out where iTunes keeps its backups on the current OS
// Copyright (c) 2019, real_acmkan. Test for macOS Catalina as Backup Location may change
func execute() {
fmt.Println("Mac Detected. Perfoming Catalina Discovery...")
out, err := exec.Command("defaults", "read", "loginwindow", "SystemVersionStampAsString").Output()
if err != nil {
fmt.Println("Failed to determine if OS is Catalina")
}
output := string(out[:])
cversion := "10.15"
if output == cversion {
fmt.Println("You're running macOS Catalina, please report if Backup Directory can't be found.")
} else {
fmt.Println("Continuing...")
}
}

// figure out where iTunes/Finder keeps its backups on the current OS
func findSyncDirs() (dirs []string, err error) {

usr, err := user.Current()
Expand All @@ -118,6 +135,7 @@ func findSyncDirs() (dirs []string, err error) {

switch runtime.GOOS {
case "darwin":
execute()
dir := filepath.Join(usr.HomeDir, "Library", "Application Support", "MobileSync", "Backup")
dirs = appendIfDir(dirs, dir)

Expand Down