package workspace import ( "fmt" "path/filepath" "strings" "gitea.maximumdirect.net/eric/notarius/internal/core/config" ) type Settings struct { RootDir string DiagnosticsRoot string CheckpointsRoot string DebugRoot string DiagnosticsEnabled bool ResumeEnabled bool DebugEnabled bool } func FromConfig(cfg config.Config) Settings { _ = cfg return Settings{} } func (s Settings) DiagnosticsRunDirectory(runID string) (string, error) { if !s.DiagnosticsEnabled || strings.TrimSpace(s.DiagnosticsRoot) == "" { return "", nil } return safeSingleDirectory(s.DiagnosticsRoot, runID, "diagnostics run ID") } func (s Settings) DebugRunDirectory(runID string) (string, error) { if !s.DebugEnabled || strings.TrimSpace(s.DebugRoot) == "" { return "", nil } return safeSingleDirectory(s.DebugRoot, runID, "debug run ID") } func cleanPath(path string) string { path = strings.TrimSpace(path) if path == "" { return "" } return filepath.Clean(path) } func safeSingleDirectory(root string, name string, label string) (string, error) { name = strings.TrimSpace(name) if strings.Contains(name, "/") || strings.Contains(name, `\`) { return "", fmt.Errorf("%s %q must be a single directory name", label, name) } return SafePath(root, name) }