| 1444 | } |
| 1445 | |
| 1446 | func pullRequestCloneDestination(repo string, prNumber int) (string, error) { |
| 1447 | if prNumber <= 0 { |
| 1448 | return "", fmt.Errorf("invalid pull request number %d", prNumber) |
| 1449 | } |
| 1450 | |
| 1451 | repoName := strings.TrimSuffix(filepath.Base(repo), ".git") |
| 1452 | if strings.TrimSpace(repoName) == "" { |
| 1453 | return "", fmt.Errorf("invalid repository name %q", repo) |
| 1454 | } |
| 1455 | |
| 1456 | homeDir, err := os.UserHomeDir() |
| 1457 | if err != nil { |
| 1458 | return "", fmt.Errorf("determine home directory: %w", err) |
| 1459 | } |
| 1460 | |
| 1461 | return filepath.Join(homeDir, "pr", fmt.Sprintf("%s-pr%d", repoName, prNumber)), nil |
| 1462 | } |
| 1463 | |
| 1464 | func openInCursor(ctx *snap.Context, path string) error { |
| 1465 | cursorApp := "/Applications/Cursor.app" |