NewExerciseFromDir constructs an exercise given the exercise directory.
(dir string)
| 15 | |
| 16 | // NewExerciseFromDir constructs an exercise given the exercise directory. |
| 17 | func NewExerciseFromDir(dir string) Exercise { |
| 18 | slug := filepath.Base(dir) |
| 19 | dir = filepath.Dir(dir) |
| 20 | track := filepath.Base(dir) |
| 21 | root := filepath.Dir(dir) |
| 22 | return Exercise{Root: root, Track: track, Slug: slug} |
| 23 | } |
| 24 | |
| 25 | // Path is the normalized relative path. |
| 26 | // It always has forward slashes, regardless |
no outgoing calls