ValidatePath checks that path is a valid relative input path within the working directory by delegating to FileIO.Stat. Returns nil if the path is valid or does not exist yet; returns an error only for illegal paths (absolute, traversal, symlink escape, control chars). NOTE: This validates input (r
(path string)
| 653 | // the FileIO implementation. For output (write) path validation, use |
| 654 | // ResolveSavePath instead. |
| 655 | func (ctx *RuntimeContext) ValidatePath(path string) error { |
| 656 | fio := ctx.FileIO() |
| 657 | if fio == nil { |
| 658 | return fmt.Errorf("no file I/O provider registered") |
| 659 | } |
| 660 | if _, err := fio.Stat(path); err != nil && !os.IsNotExist(err) { |
| 661 | return err |
| 662 | } |
| 663 | return nil |
| 664 | } |
| 665 | |
| 666 | // ── Output helpers ── |
| 667 |
no test coverage detected