Archived
1
0

Fixes output path generation for the compile command

This commit is contained in:
Jip J. Dekker 2016-04-13 19:20:08 +02:00
parent a72f9d02a6
commit e4664f6183
3 changed files with 12 additions and 7 deletions

View File

@ -36,19 +36,23 @@ func CompileDir(path string, opts *settings.Settings) {
filepath.Walk(path, compilePath(path, opts, collector))
PrepareLilypond(opts)
for _, score := range scores {
score.GenerateOutputPath(opts)
for i := range scores {
scores[i].GenerateOutputPath(opts)
if !helpers.Exists(score.OutputPath) ||
score.LastModified.After(helpers.LastModified(score.OutputPath)) {
msg, err := Lilypond(score.Path)
if !helpers.Exists(scores[i].OutputPath) ||
scores[i].LastModified.After(helpers.LastModified(scores[i].OutputPath)) {
msg, err := Lilypond(scores[i].Path)
if err != nil {
log.WithFields(log.Fields{
"message": msg,
"error": err,
"score": score,
"score": scores[i],
}).Warning("score failed to compile")
}
} else {
log.WithFields(log.Fields{
"score": scores[i],
}).Debug("skipping compilation")
}
}
}

View File

@ -43,7 +43,7 @@ func compilePath(root string, opts *settings.Settings,
helpers.Check(err, "Unable to create relative Path")
for _, dir := range append(append(opts.IgnoreDirs, opts.LilypondIncludes...), opts.OutputDir) {
if relPath == dir || (filepath.IsAbs(dir) && path == dir) {
log.WithFields(log.Fields{"path": path}).Debug("Ignoring directory")
log.WithFields(log.Fields{"path": path}).Debug("ignoring directory")
return filepath.SkipDir
}
}

View File

@ -56,5 +56,6 @@ func Lilypond(path string) (string, error) {
"cmd": cmd,
}).Info("compiling file using lilypond")
out, err := cmd.CombinedOutput()
log.Debug("finished compiling")
return string(out), err
}