Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
Allow for exercises in 'exercises' subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
kytrinyx committed Jan 21, 2016
1 parent 37ecb97 commit 17e58b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions configlet/track.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,30 @@ func (t Track) Dirs() (map[string]struct{}, error) {
}

for _, info := range infos {
if info.IsDir() {
if info.IsDir() && info.Name() != "exercises" {
dirs[info.Name()] = struct{}{}
}
}
return dirs, nil
}

// ExerciseDirs lists all directories within the "exercises" directory.
// An implemented problem must be either in the root (legacy) or in the
// exercises dir.
func (t Track) ExerciseDirs() (map[string]struct{}, error) {
dirs := make(map[string]struct{})
path := filepath.Join(t.path, "exercises")
if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
return dirs, nil
}
return dirs, err
}

infos, err := ioutil.ReadDir(filepath.Join(t.path, "exercises"))
infos, err = ioutil.ReadDir(filepath.Join(t.path, "exercises"))
if err != nil {
fmt.Println(err)
return dirs, err
}

for _, info := range infos {
if info.IsDir() {
if info.IsDir() && info.Name() != "exercises" {
dirs[info.Name()] = struct{}{}
}
}

return dirs, nil
}

Expand Down

0 comments on commit 17e58b8

Please sign in to comment.