admin: able to sync splitted files
This commit is contained in:
parent
b4057c1a2c
commit
a543be0255
1 changed files with 32 additions and 2 deletions
|
@ -34,9 +34,39 @@ func SyncExerciceFiles(i Importer, exercice fic.Exercice) []string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import files
|
// Import splitted files
|
||||||
|
var splittedFiles []string
|
||||||
for _, fname := range files {
|
for _, fname := range files {
|
||||||
if _, err := ImportFile(path.Join(exercice.Path, "files", fname),
|
if matched, _ := path.Match("*.00", fname); matched {
|
||||||
|
fname = fname[:len(fname)-3]
|
||||||
|
splittedFiles = append(splittedFiles, fname + ".[0-9][0-9]")
|
||||||
|
files = append(files, fname)
|
||||||
|
} else if matched, _ := path.Match("*00", fname); matched {
|
||||||
|
fname = fname[:len(fname)-2]
|
||||||
|
splittedFiles = append(splittedFiles, fname + "[0-9][0-9]")
|
||||||
|
files = append(files, fname)
|
||||||
|
} else if matched, _ := path.Match("*_MERGED", fname); matched {
|
||||||
|
splittedFiles = append(splittedFiles, fname)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Import standard files
|
||||||
|
for _, fname := range files {
|
||||||
|
if fname == "DIGESTS.txt" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
foundSplitted := false
|
||||||
|
for _, sf := range splittedFiles {
|
||||||
|
if matched, _ := path.Match(sf, fname); matched {
|
||||||
|
foundSplitted = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if foundSplitted {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := i.importFile(path.Join(exercice.Path, "files", fname),
|
||||||
func(filePath string, origin string) (interface{}, error) {
|
func(filePath string, origin string) (interface{}, error) {
|
||||||
return exercice.ImportFile(filePath, origin, digests[fname])
|
return exercice.ImportFile(filePath, origin, digests[fname])
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
|
Reference in a new issue