MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / SetBaseDir

Method SetBaseDir

internal/store/gitstore.go:59–82  ·  view source on GitHub ↗

SetBaseDir updates the default directory used for auth JSON persistence when no explicit path is provided.

(dir string)

Source from the content-addressed store, hash-verified

57
58// SetBaseDir updates the default directory used for auth JSON persistence when no explicit path is provided.
59func (s *GitTokenStore) SetBaseDir(dir string) {
60 clean := strings.TrimSpace(dir)
61 if clean == "" {
62 s.dirLock.Lock()
63 s.baseDir = ""
64 s.repoDir = ""
65 s.configDir = ""
66 s.dirLock.Unlock()
67 return
68 }
69 if abs, err := filepath.Abs(clean); err == nil {
70 clean = abs
71 }
72 repoDir := filepath.Dir(clean)
73 if repoDir == "" || repoDir == "." {
74 repoDir = clean
75 }
76 configDir := filepath.Join(repoDir, "config")
77 s.dirLock.Lock()
78 s.baseDir = clean
79 s.repoDir = repoDir
80 s.configDir = configDir
81 s.dirLock.Unlock()
82}
83
84// AuthDir returns the directory used for auth persistence.
85func (s *GitTokenStore) AuthDir() string {

Calls

no outgoing calls