88 "io/fs"
99 "os"
1010 "path/filepath"
11+ "regexp"
1112 "runtime"
1213 "strings"
1314 "sync"
@@ -58,7 +59,7 @@ type Manager struct {
5859 storageDir string
5960 gitDir string
6061 runtimeDir string
61- systemDir string
62+ systemDirs [] string
6263 runtimes []Runtime
6364 credHelperConfig * credHelperConfig
6465}
@@ -69,14 +70,22 @@ type credHelperConfig struct {
6970 cliCfg * config.CLIConfig
7071}
7172
72- func New (cacheDir string , runtimes ... Runtime ) * Manager {
73- root := filepath .Join (cacheDir , "repos" )
73+ func New (cacheDir , systemDir string , runtimes ... Runtime ) * Manager {
74+ var (
75+ systemDirs []string
76+ root = filepath .Join (cacheDir , "repos" )
77+ )
78+
79+ if strings .TrimSpace (systemDir ) != "" {
80+ systemDirs = regexp .MustCompile ("[;:,]" ).Split (strings .TrimSpace (systemDir ), - 1 )
81+ }
82+
7483 return & Manager {
7584 cacheDir : cacheDir ,
7685 storageDir : root ,
7786 gitDir : filepath .Join (root , "git" ),
7887 runtimeDir : filepath .Join (root , "runtimes" ),
79- systemDir : filepath . Join ( root , "system" ) ,
88+ systemDirs : systemDirs ,
8089 runtimes : runtimes ,
8190 }
8291}
@@ -273,8 +282,10 @@ func (m *Manager) setup(ctx context.Context, runtime Runtime, tool types.Tool, e
273282}
274283
275284func (m * Manager ) GetContext (ctx context.Context , tool types.Tool , cmd , env []string ) (string , []string , error ) {
276- if strings .HasPrefix (tool .WorkingDir , m .systemDir ) {
277- return tool .WorkingDir , env , nil
285+ for _ , systemDir := range m .systemDirs {
286+ if strings .HasPrefix (tool .WorkingDir , systemDir ) {
287+ return tool .WorkingDir , env , nil
288+ }
278289 }
279290
280291 var isLocal bool
0 commit comments