sync: Extract function that import files from importer

This commit is contained in:
nemunaire 2019-07-05 19:07:28 +02:00
commit 3f55845374
3 changed files with 131 additions and 85 deletions

View file

@ -58,7 +58,7 @@ func getFileSize(i Importer, URI string) (size int64, err error) {
for _, fname := range []string{filename, filename + "."} {
found := false
for _, file := range files {
if matched, _ := path.Match(fname + "[0-9][0-9]", file); matched {
if matched, _ := path.Match(fname+"[0-9][0-9]", file); matched {
found = true
if fi, err := i.stat(path.Join(dirname, file)); err != nil {
return size, err
@ -95,7 +95,7 @@ func getFile(i Importer, URI string, writer *bufio.Writer) error {
for _, fname := range []string{filename, filename + "."} {
found := false
for _, file := range files {
if matched, _ := path.Match(fname + "[0-9][0-9]", file); matched {
if matched, _ := path.Match(fname+"[0-9][0-9]", file); matched {
found = true
if err := i.getFile(path.Join(dirname, file), writer); err != nil {
return err