Skip to content

Commit

Permalink
Fix the importing of files with wildcard in the path (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
yixinglu committed Sep 13, 2021
1 parent 2d3d6e2 commit dfbc49a
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,31 @@ func (f *File) expandFiles(dir string) (err error, files []*File) {
return err, files
}

for _, name := range fileNames {
eachConf := f
eachConf.Path = &name
if len(fileNames) == 1 {
files = append(files, f)
return err, files
}

for i := range fileNames {
var failedDataPath *string = nil
if f.FailDataPath != nil {
base := filepath.Base(fileNames[i])
tmp := filepath.Join(*f.FailDataPath, base)
failedDataPath = &tmp
logger.Infof("Failed data path: %v", *failedDataPath)
}
eachConf := &File{
Path: &fileNames[i],
FailDataPath: failedDataPath,
BatchSize: f.BatchSize,
Limit: f.Limit,
InOrder: f.InOrder,
Type: f.Type,
CSV: f.CSV,
Schema: f.Schema,
}
files = append(files, eachConf)
logger.Infof("find file: %v", *f.Path)
logger.Infof("find file: %v", *eachConf.Path)
}
}

Expand Down

0 comments on commit dfbc49a

Please sign in to comment.