sync: Expose sync.Exists function
This commit is contained in:
parent
5cf4565573
commit
c5a059bd3b
8 changed files with 31 additions and 31 deletions
|
@ -139,9 +139,9 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
|
|||
e.Title = fixnbsp(e.Title)
|
||||
|
||||
// Texts to format using Markdown
|
||||
if i.exists(path.Join(epath, "overview.txt")) {
|
||||
if i.Exists(path.Join(epath, "overview.txt")) {
|
||||
e.Overview, err = GetFileContent(i, path.Join(epath, "overview.txt"))
|
||||
} else if i.exists(path.Join(epath, "overview.md")) {
|
||||
} else if i.Exists(path.Join(epath, "overview.md")) {
|
||||
e.Overview, err = GetFileContent(i, path.Join(epath, "overview.md"))
|
||||
} else {
|
||||
err = fmt.Errorf("Unable to find overview.txt nor overview.md")
|
||||
|
@ -171,9 +171,9 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
|
|||
}
|
||||
}
|
||||
|
||||
if i.exists(path.Join(epath, "statement.txt")) {
|
||||
if i.Exists(path.Join(epath, "statement.txt")) {
|
||||
e.Statement, err = GetFileContent(i, path.Join(epath, "statement.txt"))
|
||||
} else if i.exists(path.Join(epath, "statement.md")) {
|
||||
} else if i.Exists(path.Join(epath, "statement.md")) {
|
||||
e.Statement, err = GetFileContent(i, path.Join(epath, "statement.md"))
|
||||
} else {
|
||||
err = fmt.Errorf("Unable to find statement.txt nor statement.md")
|
||||
|
@ -193,9 +193,9 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
|
|||
}
|
||||
}
|
||||
|
||||
if i.exists(path.Join(epath, "finished.txt")) {
|
||||
if i.Exists(path.Join(epath, "finished.txt")) {
|
||||
e.Finished, err = GetFileContent(i, path.Join(epath, "finished.txt"))
|
||||
} else if i.exists(path.Join(epath, "finished.md")) {
|
||||
} else if i.Exists(path.Join(epath, "finished.md")) {
|
||||
e.Finished, err = GetFileContent(i, path.Join(epath, "finished.md"))
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -274,7 +274,7 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
|
|||
resolutionFound := false
|
||||
|
||||
e.VideoURI = path.Join(epath, "resolution.mp4")
|
||||
if !i.exists(e.VideoURI) {
|
||||
if !i.Exists(e.VideoURI) {
|
||||
e.VideoURI = ""
|
||||
} else if size, err := GetFileSize(i, e.VideoURI); err != nil {
|
||||
errs = append(errs, NewExerciceError(e, fmt.Errorf("resolution.mp4: %w", err), theme))
|
||||
|
@ -288,11 +288,11 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
|
|||
}
|
||||
|
||||
writeup := path.Join(epath, "resolution.md")
|
||||
if !i.exists(writeup) {
|
||||
if !i.Exists(writeup) {
|
||||
writeup = path.Join(epath, "resolution.txt")
|
||||
}
|
||||
|
||||
if i.exists(writeup) {
|
||||
if i.Exists(writeup) {
|
||||
if size, err := GetFileSize(i, writeup); err != nil {
|
||||
errs = append(errs, NewExerciceError(e, fmt.Errorf("resolution.md: %w", err), theme))
|
||||
} else if size == 0 {
|
||||
|
|
Reference in a new issue