aboutsummaryrefslogtreecommitdiffhomepage
path: root/fst
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2024-12-28 14:07:49 +0900
committerOphestra <cat@gensokyo.uk>2024-12-28 14:07:49 +0900
commitb9e2003d5b078a0704ee751aec80cfe8b4434646 (patch)
tree3f502f01cdbdefa4bf4138bb0288dd7562eaca76 /fst
parent66ec0d882f6e4bcd6d9318c59e8c8b9a174d8115 (diff)
app: ensure extra paths
The primary use case for extra perms is app-specific state directories, which may or may not exist (first run of any app). Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'fst')
-rw-r--r--fst/config.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/fst/config.go b/fst/config.go
index 27e13f04..ea7d45ad 100644
--- a/fst/config.go
+++ b/fst/config.go
@@ -81,6 +81,7 @@ type SandboxConfig struct {
}
type ExtraPermConfig struct {
+ Ensure bool `json:"ensure,omitempty"`
Path string `json:"path"`
Read bool `json:"r,omitempty"`
Write bool `json:"w,omitempty"`
@@ -88,8 +89,12 @@ type ExtraPermConfig struct {
}
func (e *ExtraPermConfig) String() string {
- buf := make([]byte, 0, 4+len(e.Path))
- buf = append(buf, '-', '-', '-', ':')
+ buf := make([]byte, 0, 5+len(e.Path))
+ buf = append(buf, '-', '-', '-')
+ if e.Ensure {
+ buf = append(buf, '+')
+ }
+ buf = append(buf, ':')
buf = append(buf, []byte(e.Path)...)
if e.Read {
buf[0] = 'r'