sync: Expose sync.Exists function

This commit is contained in:
nemunaire 2023-05-03 10:54:02 +02:00
parent 5cf4565573
commit c5a059bd3b
8 changed files with 31 additions and 31 deletions

View file

@ -18,7 +18,7 @@ import (
func BuildFilesListInto(i Importer, exercice *fic.Exercice, into string) (files []string, digests map[string][]byte, errs []error) {
// If no files directory, don't display error
if !i.exists(path.Join(exercice.Path, into)) {
if !i.Exists(path.Join(exercice.Path, into)) {
return
}
@ -80,7 +80,7 @@ func CheckExerciceFilesPresence(i Importer, exercice *fic.Exercice) (files []str
errs = append(errs, berrs...)
for _, fname := range flist {
if !i.exists(path.Join(exercice.Path, "files", fname)) {
if !i.Exists(path.Join(exercice.Path, "files", fname)) {
errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("No such file or directory")))
} else if _, ok := digests[fname]; !ok {
errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("unable to import file: No digest given")))
@ -90,7 +90,7 @@ func CheckExerciceFilesPresence(i Importer, exercice *fic.Exercice) (files []str
}
for fname := range digests {
if !i.exists(path.Join(exercice.Path, "files", fname)) {
if !i.Exists(path.Join(exercice.Path, "files", fname)) {
errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("unable to read file: No such file or directory. Check your DIGESTS.txt for legacy entries.")))
}
}