mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Signed-off-by: renovate[bot] <renovate[bot]@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: argoproj-renovate[bot] <161757507+argoproj-renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
24 lines
534 B
Go
24 lines
534 B
Go
package io
|
|
|
|
import "io/fs"
|
|
|
|
type composableFS struct {
|
|
innerFS []fs.FS
|
|
}
|
|
|
|
// NewComposableFS creates files system that attempts reading file from multiple wrapped file systems
|
|
func NewComposableFS(innerFS ...fs.FS) *composableFS {
|
|
return &composableFS{innerFS: innerFS}
|
|
}
|
|
|
|
// Open attempts open file in wrapped file systems and returns first successful
|
|
func (c composableFS) Open(name string) (f fs.File, err error) {
|
|
for i := range c.innerFS {
|
|
f, err = c.innerFS[i].Open(name)
|
|
if err == nil {
|
|
break
|
|
}
|
|
}
|
|
return f, err
|
|
}
|