sync: alert when imported file is empty

This commit is contained in:
nemunaire 2018-06-24 18:53:10 +02:00 committed by Pierre-Olivier Mercier
parent a6bc0727b2
commit 66391baeef

View File

@ -71,12 +71,14 @@ func SyncExerciceFiles(i Importer, exercice fic.Exercice) (errs []string) {
continue
}
if _, err := i.importFile(path.Join(exercice.Path, "files", fname),
if f, err := i.importFile(path.Join(exercice.Path, "files", fname),
func(filePath string, origin string) (interface{}, error) {
return exercice.ImportFile(filePath, origin, digests[fname])
}); err != nil {
errs = append(errs, fmt.Sprintf("%q: unable to import file %q: %s", path.Base(exercice.Path), fname, err))
continue
} else if f.(fic.EFile).Size == 0 {
errs = append(errs, fmt.Sprintf("%q: WARNING imported file %q is empty!", path.Base(exercice.Path), fname))
}
}
}