sync: Allow using challenge.toml instead of challenge.txt

This commit is contained in:
nemunaire 2023-05-05 15:25:20 +02:00
commit 2140939364
4 changed files with 12 additions and 6 deletions

View file

@ -112,7 +112,13 @@ func (p ExerciceParams) GetRawFlags() (ret []string) {
// parseExerciceParams reads challenge definitions from defines.txt and extract usefull data to set up the challenge.
func parseExerciceParams(i Importer, exPath string) (p ExerciceParams, md toml.MetaData, err error) {
var defs string
defs, err = GetFileContent(i, path.Join(exPath, "challenge.txt"))
if i.Exists(path.Join(exPath, "challenge.toml")) {
defs, err = GetFileContent(i, path.Join(exPath, "challenge.toml"))
} else {
defs, err = GetFileContent(i, path.Join(exPath, "challenge.txt"))
}
if err != nil {
return
}