admin: localimporter can make symlink instead of copying whole files

This commit is contained in:
nemunaire 2017-12-12 07:13:38 +01:00 committed by Pierre-Olivier Mercier
parent ad5ea6801e
commit 17dd69ac30
5 changed files with 63 additions and 24 deletions

View file

@ -15,11 +15,11 @@ func SyncExerciceHints(i Importer, exercice fic.Exercice) []string {
} else if hints, err := i.listDir(path.Join(exercice.Path, "hints")); err != nil {
errs = append(errs, err.Error())
} else {
for _, hfile := range hints {
for n, hfile := range hints {
if hint_cnt, err := getFileContent(i, path.Join(exercice.Path, "hints", hfile)); err != nil {
errs = append(errs, fmt.Sprintf("%q: unable to read hint file %q: %s", path.Base(exercice.Path), hfile, err))
continue
} else if _, err := exercice.AddHint(hfile, hint_cnt, 1); err != nil {
} else if _, err := exercice.AddHint(fmt.Sprintf("Indice #%d", n + 1), hint_cnt, 1); err != nil {
errs = append(errs, fmt.Sprintf("%q: unable to add hint %q: %s", path.Base(exercice.Path), hfile, err))
continue
}