()
| 327 | } |
| 328 | |
| 329 | func (sf solutionFile) relativePath() string { |
| 330 | file := sf.path |
| 331 | |
| 332 | // Work around a path bug due to an early design decision (later reversed) to |
| 333 | // allow numeric suffixes for exercise directories, letting people have |
| 334 | // multiple parallel versions of an exercise. |
| 335 | pattern := fmt.Sprintf(`\A.*[/\\]%s-\d*/`, sf.slug) |
| 336 | rgxNumericSuffix := regexp.MustCompile(pattern) |
| 337 | if rgxNumericSuffix.MatchString(sf.path) { |
| 338 | file = string(rgxNumericSuffix.ReplaceAll([]byte(sf.path), []byte(""))) |
| 339 | } |
| 340 | |
| 341 | // Rewrite paths submitted with an older, buggy client where the Windows path is being treated as part of the filename. |
| 342 | file = strings.Replace(file, "\\", "/", -1) |
| 343 | |
| 344 | return filepath.FromSlash(file) |
| 345 | } |
| 346 | |
| 347 | func setupDownloadFlags(flags *pflag.FlagSet) { |
| 348 | flags.StringP("uuid", "u", "", "the solution UUID") |
no outgoing calls