| 28 | ) |
| 29 | |
| 30 | func setupWaveEnvVars() error { |
| 31 | homeDir, err := os.UserHomeDir() |
| 32 | if err != nil { |
| 33 | return fmt.Errorf("failed to get home directory: %w", err) |
| 34 | } |
| 35 | |
| 36 | isDev := os.Getenv("WAVETERM_DEV") != "" |
| 37 | devSuffix := "" |
| 38 | if isDev { |
| 39 | devSuffix = "-dev" |
| 40 | } |
| 41 | |
| 42 | configHome := os.Getenv("WAVETERM_CONFIG_HOME") |
| 43 | if configHome == "" { |
| 44 | configHome = filepath.Join(homeDir, ".config", "waveterm"+devSuffix) |
| 45 | os.Setenv("WAVETERM_CONFIG_HOME", configHome) |
| 46 | } |
| 47 | log.Printf("Using config directory: %s", configHome) |
| 48 | |
| 49 | dataHome := os.Getenv("WAVETERM_DATA_HOME") |
| 50 | if dataHome == "" { |
| 51 | if runtime.GOOS == "darwin" { |
| 52 | dataHome = filepath.Join(homeDir, "Library", "Application Support", "waveterm"+devSuffix) |
| 53 | os.Setenv("WAVETERM_DATA_HOME", dataHome) |
| 54 | } else { |
| 55 | return fmt.Errorf("WAVETERM_DATA_HOME must be set on non-macOS systems") |
| 56 | } |
| 57 | } |
| 58 | log.Printf("Using data directory: %s", dataHome) |
| 59 | |
| 60 | return nil |
| 61 | } |
| 62 | |
| 63 | func initTestHarness(autoAccept bool) error { |
| 64 | log.Printf("Initializing test harness...") |