From e4664f6183e31066fa795a36da4c06a71e1d1bdd Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Wed, 13 Apr 2016 19:20:08 +0200 Subject: [PATCH] Fixes output path generation for the compile command --- compiler/compile.go | 16 ++++++++++------ compiler/file_discovery.go | 2 +- compiler/lilypond.go | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/compiler/compile.go b/compiler/compile.go index 407fb3a..9ca1826 100644 --- a/compiler/compile.go +++ b/compiler/compile.go @@ -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") } } } diff --git a/compiler/file_discovery.go b/compiler/file_discovery.go index 474b2ac..f335f20 100644 --- a/compiler/file_discovery.go +++ b/compiler/file_discovery.go @@ -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 } } diff --git a/compiler/lilypond.go b/compiler/lilypond.go index bdf0c75..11c1642 100644 --- a/compiler/lilypond.go +++ b/compiler/lilypond.go @@ -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 }