Better error messages for globbing errors

This commit is contained in:
Jakob Borg 2015-12-15 10:04:13 +01:00
parent 33173e76a0
commit 2280566bca
2 changed files with 12 additions and 8 deletions

View File

@ -85,16 +85,18 @@ func (v Simple) Archive(filePath string) error {
} }
// Glob according to the new file~timestamp.ext pattern. // Glob according to the new file~timestamp.ext pattern.
newVersions, err := osutil.Glob(filepath.Join(dir, taggedFilename(file, TimeGlob))) pattern := filepath.Join(dir, taggedFilename(file, TimeGlob))
newVersions, err := osutil.Glob(pattern)
if err != nil { if err != nil {
l.Warnln("globbing:", err) l.Warnln("globbing:", err, "for", pattern)
return nil return nil
} }
// Also according to the old file.ext~timestamp pattern. // Also according to the old file.ext~timestamp pattern.
oldVersions, err := osutil.Glob(filepath.Join(dir, file+"~"+TimeGlob)) pattern = filepath.Join(dir, file+"~"+TimeGlob)
oldVersions, err := osutil.Glob(pattern)
if err != nil { if err != nil {
l.Warnln("globbing:", err) l.Warnln("globbing:", err, "for", pattern)
return nil return nil
} }

View File

@ -258,16 +258,18 @@ func (v Staggered) Archive(filePath string) error {
} }
// Glob according to the new file~timestamp.ext pattern. // Glob according to the new file~timestamp.ext pattern.
newVersions, err := osutil.Glob(filepath.Join(dir, taggedFilename(file, TimeGlob))) pattern := filepath.Join(dir, taggedFilename(file, TimeGlob))
newVersions, err := osutil.Glob(pattern)
if err != nil { if err != nil {
l.Warnln("globbing:", err) l.Warnln("globbing:", err, "for", pattern)
return nil return nil
} }
// Also according to the old file.ext~timestamp pattern. // Also according to the old file.ext~timestamp pattern.
oldVersions, err := osutil.Glob(filepath.Join(dir, file+"~"+TimeGlob)) pattern = filepath.Join(dir, file+"~"+TimeGlob)
oldVersions, err := osutil.Glob(pattern)
if err != nil { if err != nil {
l.Warnln("globbing:", err) l.Warnln("globbing:", err, "for", pattern)
return nil return nil
} }