api/go-io/local.go
Virgil 16abc45efa feat(api): add stable openapi operation ids
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 07:36:35 +00:00

29 lines
609 B
Go

// SPDX-License-Identifier: EUPL-1.2
package io
import "os"
// LocalFS provides simple local filesystem helpers used by the API module.
var Local localFS
type localFS struct{}
// EnsureDir creates the directory path if it does not already exist.
func (localFS) EnsureDir(path string) error {
if path == "" || path == "." {
return nil
}
return os.MkdirAll(path, 0o755)
}
// Delete removes the named file, ignoring missing files.
func (localFS) Delete(path string) error {
if path == "" {
return nil
}
if err := os.Remove(path); err != nil && !os.IsNotExist(err) {
return err
}
return nil
}