diff options
| author | Jeff Carr <[email protected]> | 2024-03-01 21:35:42 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-03-01 21:35:42 -0600 |
| commit | de662f3b181fe85d97d4b3b249ebd1c09576c736 (patch) | |
| tree | 97217123a5149e23acf51f8e77b85274f61896ae /scan.go | |
| parent | e3202ae1e997057702da62466ab8d61c53bca9ff (diff) | |
save name of the cfgfilev0.21.2
Diffstat (limited to 'scan.go')
| -rw-r--r-- | scan.go | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -2,10 +2,13 @@ package repolist import ( "fmt" + "os" + "path/filepath" "strconv" "strings" "go.wit.com/log" + "go.wit.com/lib/gui/repostatus" ) func (r *RepoList) RegisterHideFunction(f func(*RepoRow)) { @@ -70,3 +73,26 @@ func (r *RepoRow) NewScan() int { return changed } + +func ScanGitDirectories(srcDir string) []string { + var all []string + err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + log.Log(REPOWARN, "Error accessing path:", path, err) + return nil + } + + // Check if the path is a directory and has a .git subdirectory + if info.IsDir() && repostatus.IsGitDir(path) { + all = append(all, path) + } + + return nil + }) + + if err != nil { + log.Log(REPOWARN, "Error walking the path:", srcDir, err) + } + + return all +} |
