Documentation
¶
Overview ¶
Package workspace provides a filesystem confined to a single root directory. Every operation resolves the caller-supplied path against the root and refuses any path that would escape it, so it is safe to drive from an HTTP API. It backs the Dexaflow Lite web editor (ADR 0025); it is never the Production path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsafePath = errors.New("unsafe path")
ErrUnsafePath is returned (wrapped) when a requested path is absolute or would escape the workspace root. Callers can map it to a client error with errors.Is.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Path string `json:"path"`
Name string `json:"name"`
IsDir bool `json:"is_dir"`
Size int64 `json:"size"`
}
Entry is one node in the workspace tree. Path is relative to the root and always slash-separated.
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is a filesystem confined to a single root directory. The zero value is not usable; construct one with New.
func New ¶
New returns an FS rooted at dir. dir must be an existing directory; New resolves it to an absolute, symlink-free path so later confinement checks are exact.
func (*FS) Create ¶
Create makes an empty file at rel, or a directory when dir is true, including any missing parents.
func (*FS) Move ¶
Move renames or relocates a file or directory inside the workspace. It auto-creates any missing parent directories on the destination side, and refuses to clobber an existing destination — the IDE surface (drag-drop / rename) asks the user to pick a fresh name on a collision.