Mercurial > gemma
comparison pkg/imports/sr.go @ 1528:5874cedd7f91
Sounding result import: Accept *.txt files for XYZ data, too.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 07 Dec 2018 12:21:55 +0100 |
parents | 0abcc82ef976 |
children | 24445a618513 |
comparison
equal
deleted
inserted
replaced
1527:3cc3b7390805 | 1528:5874cedd7f91 |
---|---|
211 | 211 |
212 if err := m.Validate(ctx, conn); err != nil { | 212 if err := m.Validate(ctx, conn); err != nil { |
213 return nil, common.ToError(err) | 213 return nil, common.ToError(err) |
214 } | 214 } |
215 | 215 |
216 feedback.Info("Looking for '*.xyz'") | 216 var xyzf *zip.File |
217 xyzf := common.FindInZIP(z, ".xyz") | 217 for _, ext := range []string{".xyz", ".txt"} { |
218 feedback.Info("Looking for '*%s'", ext) | |
219 if xyzf = common.FindInZIP(z, ext); xyzf != nil { | |
220 break | |
221 } | |
222 } | |
218 if xyzf == nil { | 223 if xyzf == nil { |
219 return nil, errors.New("Cannot find any *.xyz file") | 224 return nil, errors.New("Cannot find any *.xyz or *.txt file") |
220 } | 225 } |
221 | 226 |
222 xyz, err := loadXYZ(xyzf, feedback) | 227 xyz, err := loadXYZ(xyzf, feedback) |
223 if err != nil { | 228 if err != nil { |
224 return nil, err | 229 return nil, err |