sync: Place hints files in the files/ directory
This commit is contained in:
parent
5eb1f66ba7
commit
3bd6ecf11e
@ -48,12 +48,12 @@ func buildExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
|
||||
if hint.Content != "" {
|
||||
errs = multierr.Append(errs, NewHintError(exercice, h, n, fmt.Errorf("content and filename can't be filled at the same time")))
|
||||
continue
|
||||
} else if !i.Exists(path.Join(exercice.Path, "hints", hint.Filename)) {
|
||||
} else if !i.Exists(path.Join(exercice.Path, "files", hint.Filename)) {
|
||||
errs = multierr.Append(errs, NewHintError(exercice, h, n, fmt.Errorf("%q: File not found", hint.Filename)))
|
||||
continue
|
||||
} else {
|
||||
// Handle files as downloadable content
|
||||
if res, err := i.importFile(path.Join(exercice.Path, "hints", hint.Filename), func(filePath string, origin string) (interface{}, error) {
|
||||
if res, err := i.importFile(path.Join(exercice.Path, "files", hint.Filename), func(filePath string, origin string) (interface{}, error) {
|
||||
// Calculate hash
|
||||
hash512 := crypto.BLAKE2b_512.New()
|
||||
if fd, err := os.Open(filePath); err != nil {
|
||||
@ -126,7 +126,7 @@ func CheckExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
|
||||
return buildExerciceHints(i, exercice, exceptions)
|
||||
}
|
||||
|
||||
// SyncExerciceHints reads the content of hints/ directories and import it as EHint for the given challenge.
|
||||
// SyncExerciceHints reads the content of files/ directories and import it as EHint for the given challenge.
|
||||
func SyncExerciceHints(i Importer, exercice *fic.Exercice, flagsBindings map[int64]fic.Flag, exceptions *CheckExceptions) (hintsBindings map[int]*fic.EHint, errs error) {
|
||||
if _, err := exercice.WipeHints(); err != nil {
|
||||
errs = multierr.Append(errs, err)
|
||||
|
Loading…
Reference in New Issue
Block a user